Bug 29744: (QA follow-up) Call psgi_env in OO style

Result of git grep -l -E "::psgi_env" | xargs sed -i -e's/::psgi_env/->psgi_env/g'

Also resolving this warn from Auth.t:
Use of uninitialized value $ENV{"SCRIPT_NAME"} in pattern match (m//) at /usr/share/koha/Koha/AuthUtils.pm line 211.

Note that the following warn is resolved on report 30588 (underway).
Use of uninitialized value $return in numeric gt (>) at /usr/share/koha/C4/Auth.pm line 1154.

Test plan:
Run t/db_dependent/Auth.t
Hit some opac, intranet pages. API call.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Marcel de Rooy 2022-09-16 07:20:36 +00:00 committed by Tomas Cohen Arazi
parent 097b2afb17
commit 179be45f4a
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
3 changed files with 5 additions and 5 deletions

View File

@ -81,7 +81,7 @@ sub get_login_shib {
my $matchAttribute = $config->{mapping}->{ $config->{matchpoint} }->{is};
if ( C4::Context::psgi_env ) {
if ( C4::Context->psgi_env ) {
return $ENV{"HTTP_".uc($matchAttribute)} || '';
} else {
return $ENV{$matchAttribute} || '';
@ -126,7 +126,7 @@ sub _autocreate {
my %borrower = ( $config->{matchpoint} => $match );
while ( my ( $key, $entry ) = each %{$config->{'mapping'}} ) {
if ( C4::Context::psgi_env ) {
if ( C4::Context->psgi_env ) {
$borrower{$key} = ( $entry->{'is'} && $ENV{"HTTP_" . uc($entry->{'is'}) } ) || $entry->{'content'} || '';
} else {
$borrower{$key} = ( $entry->{'is'} && $ENV{ $entry->{'is'} } ) || $entry->{'content'} || '';
@ -144,7 +144,7 @@ sub _sync {
my %borrower;
$borrower{'borrowernumber'} = $borrowernumber;
while ( my ( $key, $entry ) = each %{$config->{'mapping'}} ) {
if ( C4::Context::psgi_env ) {
if ( C4::Context->psgi_env ) {
$borrower{$key} = ( $entry->{'is'} && $ENV{"HTTP_" . uc($entry->{'is'}) } ) || $entry->{'content'} || '';
} else {
$borrower{$key} = ( $entry->{'is'} && $ENV{ $entry->{'is'} } ) || $entry->{'content'} || '';

View File

@ -208,7 +208,7 @@ outside this context.
=cut
sub get_script_name {
if ( ( C4::Context::psgi_env ) && $ENV{SCRIPT_NAME} =~ m,^/(intranet|opac)(.*), ) {
if ( ( C4::Context->psgi_env ) && $ENV{SCRIPT_NAME} && $ENV{SCRIPT_NAME} =~ m,^/(intranet|opac)(.*), ) {
return '/cgi-bin/koha' . $2;
} else {
return $ENV{SCRIPT_NAME};

View File

@ -125,7 +125,7 @@ if ($^O ne 'VMS') {
my $zebraVersion = `zebraidx -V`;
# Check running PSGI env
if ( C4::Context::psgi_env ) {
if ( C4::Context->psgi_env ) {
$template->param(
is_psgi => 1,
psgi_server => ($ENV{ PLACK_ENV }) ? "Plack ($ENV{PLACK_ENV})" :