summaryrefslogtreecommitdiff
path: root/rt/bin/webmux.pl.in
diff options
context:
space:
mode:
Diffstat (limited to 'rt/bin/webmux.pl.in')
-rw-r--r--rt/bin/webmux.pl.in57
1 files changed, 49 insertions, 8 deletions
diff --git a/rt/bin/webmux.pl.in b/rt/bin/webmux.pl.in
index b21d026..7e61b27 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-2009 Best Practical Solutions, LLC
+#
+# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
# <jesse@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
@@ -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) };