X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Fbin%2Fwebmux.pl.in;h=7e61b277506f9f140a271fdd94f434b374ec69ad;hb=b4b0c7e72d7eaee2fbfc7022022c9698323203dd;hp=f9b792f88d3369770f5d34c87a48b6310ff91a2d;hpb=ef20b2b6b1feb47ad02b5ff7525f1a0fd11d0fa4;p=freeside.git diff --git a/rt/bin/webmux.pl.in b/rt/bin/webmux.pl.in index f9b792f88..7e61b2775 100644 --- a/rt/bin/webmux.pl.in +++ b/rt/bin/webmux.pl.in @@ -2,8 +2,8 @@ # BEGIN BPS TAGGED BLOCK {{{ # # COPYRIGHT: -# -# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC +# +# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -25,7 +25,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301 or visit their web page on the internet at -# http://www.gnu.org/copyleft/gpl.html. +# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. # # # CONTRIBUTION SUBMISSION POLICY: @@ -64,7 +64,30 @@ BEGIN { } -use lib ( "@LOCAL_LIB_PATH@", "@RT_LIB_PATH@" ); +# fix lib paths, some may be relative +BEGIN { + require File::Spec; + my @libs = ("@RT_LIB_PATH@", "@LOCAL_LIB_PATH@"); + my $bin_path; + + for my $lib (@libs) { + unless ( File::Spec->file_name_is_absolute($lib) ) { + unless ($bin_path) { + if ( File::Spec->file_name_is_absolute(__FILE__) ) { + $bin_path = ( File::Spec->splitpath(__FILE__) )[1]; + } + else { + require FindBin; + no warnings "once"; + $bin_path = $FindBin::Bin; + } + } + $lib = File::Spec->catfile( $bin_path, File::Spec->updir, $lib ); + } + unshift @INC, $lib; + } + +} use RT; package RT::Mason; @@ -74,21 +97,35 @@ use vars qw($Nobody $SystemUser $Handler $r); #This drags in RT's config.pm BEGIN { RT::LoadConfig(); - if ($RT::DevelMode) { require Module::Refresh; } + if (RT->Config->Get('DevelMode')) { require Module::Refresh; } + RT->InitPluginPaths(); } - { + require RT::Handle; + my $dsn = RT::Handle->DSN; + my $user = RT->Config->Get('DatabaseUser'); + my $pass = RT->Config->Get('DatabasePassword'); + + my $dbh = DBI->connect( + $dsn, $user, $pass, + { RaiseError => 0, PrintError => 0 }, + ); + if ( $dbh ) { + my ($status, $msg) = RT::Handle->CheckCompatibility( $dbh, 'post' ); + die $msg unless $status; + } +} +{ package HTML::Mason::Commands; use vars qw(%session); } use RT::Interface::Web; use RT::Interface::Web::Handler; -$Handler = RT::Interface::Web::Handler->new(@RT::MasonParameters); -if ($ENV{'MOD_PERL'} && !$RT::DevelMode) { +if ($ENV{'MOD_PERL'} && !RT->Config->Get('DevelMode')) { # Under static_source, we need to purge the component cache # each time we restart, so newer components may be reloaded. # @@ -116,10 +153,14 @@ sub handler { #$r->content_type !~ m!(^text/|\bxml\b)!i or return -1; # } - Module::Refresh->refresh if $RT::DevelMode; + Module::Refresh->refresh if RT->Config->Get('DevelMode'); RT::Init(); + $Handler ||= RT::Interface::Web::Handler->new( + RT->Config->Get('MasonParameters') + ); + my %session; my $status; eval { $status = $Handler->handle_request($r) };