From: ivan Date: Thu, 21 Jan 2010 01:25:22 +0000 (+0000) Subject: fix self-service fallout from RT 3.8, RT#6640 X-Git-Tag: root_of_svc_elec_features~525 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=bcff37f04c502c60fea1e2824841eb2007a07ccd fix self-service fallout from RT 3.8, RT#6640 --- diff --git a/FS/FS/ClientAPI.pm b/FS/FS/ClientAPI.pm index 902f58b31..1677fcc5d 100644 --- a/FS/FS/ClientAPI.pm +++ b/FS/FS/ClientAPI.pm @@ -1,29 +1,34 @@ package FS::ClientAPI; use strict; -use vars qw(%handler $domain $DEBUG); +use base 'Exporter'; +use vars qw( @EXPORT_OK %handler $domain $DEBUG ); + +@EXPORT_OK = qw( load_clientapi_modules ); $DEBUG = 0; %handler = (); -#find modules -foreach my $INC ( @INC ) { - my $glob = "$INC/FS/ClientAPI/*.pm"; - warn "FS::ClientAPI: searching $glob" if $DEBUG; - foreach my $file ( glob($glob) ) { - $file =~ /\/(\w+)\.pm$/ or do { - warn "unrecognized ClientAPI file: $file"; - next - }; - my $mod = $1; - warn "using FS::ClientAPI::$mod" if $DEBUG; - eval "use FS::ClientAPI::$mod;"; - die "error using FS::ClientAPI::$mod: $@" if $@; +sub load_clientapi_modules { + + #find modules + foreach my $INC ( @INC ) { + my $glob = "$INC/FS/ClientAPI/*.pm"; + warn "FS::ClientAPI: searching $glob" if $DEBUG; + foreach my $file ( glob($glob) ) { + $file =~ /\/(\w+)\.pm$/ or do { + warn "unrecognized ClientAPI file: $file"; + next + }; + my $mod = $1; + warn "using FS::ClientAPI::$mod" if $DEBUG; + eval "use FS::ClientAPI::$mod;"; + die "error using FS::ClientAPI::$mod: $@" if $@; + } } -} -#--- +} sub dispatch { my ( $self, $name ) = ( shift, shift ); diff --git a/FS/FS/Mason.pm b/FS/FS/Mason.pm index c5b68f58d..7e9827cac 100644 --- a/FS/FS/Mason.pm +++ b/FS/FS/Mason.pm @@ -388,12 +388,17 @@ if ( -e $addl_handler_use_file ) { =over 4 -=item mason_interps [ MODE ] +=item mason_interps [ MODE [ OPTION => VALUE ... ] ] Returns a list consisting of two HTML::Mason::Interp objects, the first for Freeside pages, and the second for RT pages. -#MODE can be 'apache' or 'standalone'. If not specified, defaults to 'apache'. +MODE can be 'apache' or 'standalone'. If not specified, defaults to 'apache'. + +Options and values can be passed following mode. Currently available options +are: + +I should be set to a scalar reference in standalone mode. =cut @@ -406,7 +411,7 @@ sub mason_interps { my $request_class = 'FS::Mason::Request'; #not entirely sure it belongs here, but what the hey - if ( %%%RT_ENABLED%%% ) { + if ( %%%RT_ENABLED%%% && $mode ne 'standalone' ) { RT::LoadConfig(); } diff --git a/FS/bin/freeside-selfservice-server b/FS/bin/freeside-selfservice-server index f72d0ab61..1c2086ef0 100644 --- a/FS/bin/freeside-selfservice-server +++ b/FS/bin/freeside-selfservice-server @@ -13,7 +13,7 @@ use Storable 2.09 qw(nstore_fd fd_retrieve); use Net::SSH qw(sshopen2); use FS::Daemon qw(daemonize1 drop_root logfile daemonize2 sigint sigterm); use FS::UID qw(adminsuidsetup forksuidsetup); -use FS::ClientAPI; +use FS::ClientAPI qw( load_clientapi_modules ); use FS::ClientAPI_SessionCache; use FS::Record qw( qsearch qsearchs ); @@ -52,6 +52,8 @@ drop_root(); $ENV{HOME} = (getpwuid($>))[7]; #for ssh +load_clientapi_modules; + adminsuidsetup $user; #logfile("/usr/local/etc/freeside/selfservice.". $FS::UID::datasrc); #MACHINE