X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=htetc%2Fhandler.pl;h=3c68e83ed7da4e2bd6c9d8a935ea506cb5910564;hb=0491e1283637a9a89cc953b2a47f24f4e8795006;hp=2e6fbe586a9c3ca79c3fc8283d691de8026b714d;hpb=56d9a1fd046c50466c4d2a1ac6fca2d3776bf86b;p=freeside.git diff --git a/htetc/handler.pl b/htetc/handler.pl index 2e6fbe586..3c68e83ed 100644 --- a/htetc/handler.pl +++ b/htetc/handler.pl @@ -7,6 +7,23 @@ use warnings; use FS::Mason qw( mason_interps ); use FS::Trace; +if ( %%%RT_ENABLED%%% ) { + + require RT; + + $> = scalar(getpwnam('freeside')); + + RT::LoadConfig(); + RT::Init(); + + # disconnect DB before fork: + # (avoid 'prepared statement "dbdpg_p\d+_\d+" already exists' errors?) + $RT::Handle->dbh(undef); + undef $RT::Handle; + + $> = $<; +} + #use vars qw($r); # Bring in ApacheHandler, necessary for mod_perl integration. @@ -151,19 +168,10 @@ sub handler $status; } -my $rt_initialized = 0; - sub my_rt_init { return unless $RT::VERSION; - - if ( $rt_initialized ) { - RT::ConnectToDatabase(); - RT::InitSignalHandlers(); - } else { - RT::LoadConfig(); - RT::Init(); - $rt_initialized++; - } + RT::ConnectToDatabase(); + RT::InitSignalHandlers(); } 1;