debug
[freeside.git] / FS / FS / InitHandler.pm
1 package FS::InitHandler;
2
3 use strict;
4 use vars qw($DEBUG);
5 use FS::UID qw(adminsuidsetup);
6 use FS::Record;
7
8 $DEBUG = 1;
9
10 sub handler {
11
12 =pod
13
14   use Date::Format;
15   use Date::Parse;
16   use Tie::IxHash;
17   use HTML::Entities;
18   use IO::Handle;
19   use IO::File;
20   use String::Approx:
21   use HTML::Widgets::SelectLayers 0.02;
22   #use FS::UID;
23   #use FS::Record;
24   use FS::Conf;
25   use FS::CGI;
26   use FS::Msgcat;
27   
28   use FS::agent;
29   use FS::agent_type;
30   use FS::domain_record;
31   use FS::cust_bill;
32   use FS::cust_bill_pay;
33   use FS::cust_credit;
34   use FS::cust_credit_bill;
35   use FS::cust_main;
36   use FS::cust_main_county;
37   use FS::cust_pay;
38   use FS::cust_pkg;
39   use FS::cust_refund;
40   use FS::cust_svc;
41   use FS::nas;
42   use FS::part_bill_event;
43   use FS::part_pkg;
44   use FS::part_referral;
45   use FS::part_svc;
46   use FS::pkg_svc;
47   use FS::port;
48   use FS::queue qw(joblisting);
49   use FS::raddb;
50   use FS::session;
51   use FS::svc_acct;
52   use FS::svc_acct_pop qw(popselector);
53   use FS::svc_acct_sm;
54   use FS::svc_domain;
55   use FS::svc_forward;
56   use FS::svc_www;
57   use FS::type_pkgs;
58   use FS::part_export;
59   use FS::part_export_option;
60   use FS::export_svc;
61   use FS::msgcat;
62
63 =cut
64
65   warn "[FS::InitHandler] handler called\n" if $DEBUG;
66
67   open(MAPSECRETS,"<$FS::UID::conf_dir/mapsecrets")
68     or die "can't read $FS::UID::conf_dir/mapsecrets: $!";
69
70   my %seen;
71   while (<MAPSECRETS>) {
72     /^([\w\-\.]+)\s(.*)$/
73       or do { warn "strange line in mapsecrets: $_"; next; };
74     my($user, $datasrc) = ($1, $2);
75     next if $seen{$datasrc}++;
76     warn "[FS::InitHandler] preloading $datasrc for $user\n" if $DEBUG;
77     adminsuidsetup($user);
78   }
79
80   close MAPSECRETS;
81
82 }
83
84 1;