From: Mike Rylander Date: Thu, 3 Nov 2016 14:08:42 +0000 (-0400) Subject: Provide an API, because ENV is no longer friendly to us. This change makes a new... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=19557ad6c244ba8b049be29637d47c7cf8111737;p=working%2FEvergreen.git Provide an API, because ENV is no longer friendly to us. This change makes a new OpenSRF required, rather than silently degrading. Signed-off-by: Mike Rylander --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/AccessHandler.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/AccessHandler.pm index a8d0c52ca0..7684d75e7d 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/AccessHandler.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/AccessHandler.pm @@ -7,6 +7,7 @@ use Apache2::RequestRec; use Apache2::URI; # OpenSRF requirements +use OpenSRF; use OpenSRF::System; # Other requirements @@ -14,7 +15,8 @@ use URI::Escape; # Auth Handler sub handler { - my $r = $ENV{OSRF_APACHE_REQUEST_OBJ} = shift; + my $r = shift; + OpenSRF->OSRF_APACHE_REQUEST_OBJ($r); # Configuration options diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/AddedContent.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/AddedContent.pm index 700b961a6a..a7cab4bb8e 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/AddedContent.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/AddedContent.pm @@ -11,6 +11,7 @@ use Apache2::RequestUtil; use Data::Dumper; use UNIVERSAL::require; +use OpenSRF; use OpenSRF::EX qw(:try); use OpenSRF::Utils::Cache; use OpenSRF::System; @@ -88,7 +89,8 @@ sub child_init { sub handler { - my $r = $ENV{OSRF_APACHE_REQUEST_OBJ} = shift; + my $r = shift; + OpenSRF->OSRF_APACHE_REQUEST_OBJ($r); # If the URL requested matches a file on the filesystem, have Apache serve that file # this allows for local content (most typically images) to be used for some requests diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/AutoSuggest.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/AutoSuggest.pm index e7c726f0c3..e9b942d9fa 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/AutoSuggest.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/AutoSuggest.pm @@ -12,6 +12,7 @@ use Text::Glob; use CGI qw(:all -utf8); use Digest::MD5 qw(md5_hex); +use OpenSRF; use OpenSRF::Utils::JSON; use OpenILS::Utils::CStoreEditor qw/:funcs/; use OpenSRF::Utils::Logger qw/:level/; @@ -203,7 +204,9 @@ sub output_handler { sub handler { child_init() unless $init_done; - my $r = $ENV{OSRF_APACHE_REQUEST_OBJ} = shift; + my $r = shift; + OpenSRF->OSRF_APACHE_REQUEST_OBJ($r); + my $cgi = new CGI; my $editor = new_editor; diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/BadDebt.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/BadDebt.pm index 7eaa6700b9..be7922b387 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/BadDebt.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/BadDebt.pm @@ -13,6 +13,7 @@ use Apache2::RequestIO (); use Apache2::RequestUtil; use CGI; +use OpenSRF; use OpenSRF::EX qw(:try); use OpenSRF::System; use OpenSRF::AppSession; @@ -41,7 +42,9 @@ sub child_init { } sub handler { - my $r = $ENV{OSRF_APACHE_REQUEST_OBJ} = shift; + my $r = shift; + OpenSRF->OSRF_APACHE_REQUEST_OBJ($r); + my $cgi = new CGI; my $auth_ses = $cgi->cookie('ses') || $cgi->param('ses'); diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGWeb.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGWeb.pm index 2d4a27e860..056acb6c66 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGWeb.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGWeb.pm @@ -7,6 +7,7 @@ use File::stat; use Encode; use Apache2::Const -compile => qw(OK DECLINED HTTP_INTERNAL_SERVER_ERROR HTTP_NOT_FOUND HTTP_GONE); use Apache2::Log; +use OpenSRF; use OpenSRF::EX qw(:try); use OpenSRF::AppSession; use OpenILS::Utils::CStoreEditor q/:funcs/; @@ -50,7 +51,9 @@ sub child_init { } sub handler { - my $r = $ENV{OSRF_APACHE_REQUEST_OBJ} = shift; + my $r = shift; + OpenSRF->OSRF_APACHE_REQUEST_OBJ($r); + my $stat = handler_guts($r); # other opensrf clients share this apache process, diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/Exporter.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/Exporter.pm index 3482c58313..073a769e90 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/Exporter.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/Exporter.pm @@ -15,6 +15,7 @@ use CGI; use Data::Dumper; use Text::CSV; +use OpenSRF; use OpenSRF::EX qw(:try); use OpenSRF::Utils qw/:datetime/; use OpenSRF::Utils::Cache; @@ -51,7 +52,9 @@ sub child_init { } sub handler { - my $r = $ENV{OSRF_APACHE_REQUEST_OBJ} = shift; + my $r = shift; + OpenSRF->OSRF_APACHE_REQUEST_OBJ($r); + my $cgi = new CGI; # find some IDs ... diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/FlatFielder.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/FlatFielder.pm index d3dec453b1..e4c5a4fbee 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/FlatFielder.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/FlatFielder.pm @@ -12,6 +12,7 @@ use XML::LibXSLT; use Text::Glob; use CGI qw(:all -utf8); +use OpenSRF; use OpenSRF::Utils::JSON; use OpenSRF::AppSession; use OpenSRF::Utils::SettingsClient; @@ -214,7 +215,9 @@ sub output_handler { } sub handler { - my $r = $ENV{OSRF_APACHE_REQUEST_OBJ} = shift; + my $r = shift; + OpenSRF->OSRF_APACHE_REQUEST_OBJ($r); + my $cgi = new CGI; my %args; diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/IDL2js.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/IDL2js.pm index 50ad13fd51..1d7ff0a9b7 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/IDL2js.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/IDL2js.pm @@ -9,6 +9,7 @@ use Apache2::Filter; use APR::Brigade; use APR::Bucket; use Error qw/:try/; +use OpenSRF; use OpenSRF::System; use OpenSRF::Utils::SettingsClient; use CGI; @@ -58,7 +59,9 @@ sub child_init { my %idl_cache; sub handler { - my $r = $ENV{OSRF_APACHE_REQUEST_OBJ} = shift; + my $r = shift; + OpenSRF->OSRF_APACHE_REQUEST_OBJ($r); + my $args = $r->args || ''; child_init() unless $__initted; diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/PhoneList.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/PhoneList.pm index 3d42e4e57c..87ddfb2a8a 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/PhoneList.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/PhoneList.pm @@ -28,6 +28,7 @@ use Apache2::RequestIO (); use Apache2::RequestUtil; use CGI; +use OpenSRF; use OpenSRF::System; use OpenSRF::Utils::SettingsClient; use OpenSRF::Utils::Logger qw/$logger/; @@ -58,7 +59,9 @@ sub child_init { } sub handler { - my $r = $ENV{OSRF_APACHE_REQUEST_OBJ} = shift; + my $r = shift; + OpenSRF->OSRF_APACHE_REQUEST_OBJ($r); + my $cgi = new CGI; my $authid = $cgi->cookie('ses') || $cgi->param('ses'); my $user = $U->simplereq('open-ils.auth', 'open-ils.auth.session.retrieve', $authid); diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/Proxy.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/Proxy.pm index b74d25f046..4926f53b01 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/Proxy.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/Proxy.pm @@ -8,6 +8,7 @@ use CGI; use Data::Dumper; use Digest::MD5 qw/md5_hex/; +use OpenSRF; use OpenSRF::EX qw(:try); use OpenSRF::System; @@ -59,7 +60,8 @@ sub child_init { } sub handler { - my $apache = $ENV{OSRF_APACHE_REQUEST_OBJ} = shift; + my $apache = shift; + OpenSRF->OSRF_APACHE_REQUEST_OBJ($apache); my $proxyhtml = $apache->dir_config('OILSProxyHTML'); my $title = $apache->dir_config('OILSProxyTitle'); diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/Proxy/Authen.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/Proxy/Authen.pm index 3a5b2c7008..34240fd705 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/Proxy/Authen.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/Proxy/Authen.pm @@ -10,6 +10,7 @@ use CGI; use Data::Dumper; use Digest::MD5 qw/md5_hex/; +use OpenSRF; use OpenSRF::EX qw(:try); use OpenSRF::System; @@ -31,7 +32,8 @@ sub child_init { } sub handler { - my $apache = $ENV{OSRF_APACHE_REQUEST_OBJ} = shift; + my $apache = shift; + OpenSRF->OSRF_APACHE_REQUEST_OBJ($apache); my $ltype = $apache->dir_config('OILSProxyLoginType'); my $perms = [ split ' ', $apache->dir_config('OILSProxyPermissions') ]; diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/Redirect.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/Redirect.pm index 924edc1fc8..39d888b009 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/Redirect.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/Redirect.pm @@ -9,6 +9,7 @@ use Apache2::RequestRec (); use Apache2::RequestIO (); use CGI (); +use OpenSRF; use OpenSRF::AppSession; use OpenSRF::System; use OpenSRF::Utils::Logger qw/$logger/; @@ -53,7 +54,8 @@ sub parse_ips_file { my %org_cache; sub handler { - my $apache = $ENV{OSRF_APACHE_REQUEST_OBJ} = shift; + my $apache = shift; + OpenSRF->OSRF_APACHE_REQUEST_OBJ($apache); my $cgi = CGI->new( $apache ); my $port = $cgi->server_port(); diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/Reporter.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/Reporter.pm index 1d27104ce5..aecfa19c1a 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/Reporter.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/Reporter.pm @@ -14,6 +14,7 @@ use Data::Dumper; use Template; +use OpenSRF; use OpenSRF::EX qw(:try); use OpenSRF::System; use XML::LibXML; @@ -54,7 +55,9 @@ sub child_init { sub handler { - my $apache = $ENV{OSRF_APACHE_REQUEST_OBJ} = shift; + my $apache = shift; + OpenSRF->OSRF_APACHE_REQUEST_OBJ($apache); + return Apache2::Const::DECLINED if (-e $apache->filename); my $cgi = CGI->new; diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/TemplateBatchBibUpdate.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/TemplateBatchBibUpdate.pm index 65b761aa1c..5e2fdc6280 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/TemplateBatchBibUpdate.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/TemplateBatchBibUpdate.pm @@ -15,6 +15,7 @@ use CGI; use Data::Dumper; use Text::CSV; +use OpenSRF; use OpenSRF::EX qw(:try); use OpenSRF::Utils qw/:datetime/; use OpenSRF::Utils::Cache; @@ -52,7 +53,9 @@ sub child_init { } sub handler { - my $r = $ENV{OSRF_APACHE_REQUEST_OBJ} = shift; + my $r = shift; + OpenSRF->OSRF_APACHE_REQUEST_OBJ($r); + my $cgi = new CGI; my $authid = $cgi->cookie('ses') || $cgi->param('ses'); diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/XMLRPCGateway.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/XMLRPCGateway.pm index 96f2a23ad3..69844bba17 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/XMLRPCGateway.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/XMLRPCGateway.pm @@ -12,6 +12,7 @@ use Data::Dumper; use UNIVERSAL::require; use XML::LibXML; +use OpenSRF; use OpenSRF::EX qw(:try); use OpenSRF::System; use OpenSRF::Utils::Cache; @@ -54,7 +55,9 @@ sub child_init { sub handler { - my $r = $ENV{OSRF_APACHE_REQUEST_OBJ} = shift; + my $r = shift; + OpenSRF->OSRF_APACHE_REQUEST_OBJ($r); + my $cgi = CGI->new; my $service = $r->path_info; $service =~ s#^/##;