From 02492bd6eadadcf67e173f3d219b2f5aa895371b Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 16 Oct 2015 08:05:46 +0000 Subject: [PATCH] Bug 15005: Replace $ENV{SCRIPT_NAME} with the hardcoded script paths Since I don't manage to make SCRIPT_NAME works directly with RequestHeader and/or ReverseProxyPath, the easier way it to fix all the different occurrences. Test plan: On the import patrons page, confirm that the "Import" button does not redirect to a 'Not found' page. You should stay on the import patrons page. Note that if this change works, all others should work too. Have a look at the diff of this patch and confirm there is no typo. Signed-off-by: Josef Moravec Tested in patron import and item batch modification Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi --- offline_circ/process_koc.pl | 4 ++-- tools/batchMod.pl | 4 ++-- tools/batch_record_modification.pl | 4 ++-- tools/import_borrowers.pl | 2 +- tools/manage-marc-import.pl | 4 ++-- tools/showdiffmarc.pl | 2 +- tools/stage-marc-import.pl | 6 +++--- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/offline_circ/process_koc.pl b/offline_circ/process_koc.pl index 21462eff63..8381b1bde2 100755 --- a/offline_circ/process_koc.pl +++ b/offline_circ/process_koc.pl @@ -78,7 +78,7 @@ if ($completedJobID) { if ($runinbackground) { my $job_size = scalar(@input_lines); - $job = C4::BackgroundJob->new($sessionID, $filename, $ENV{'SCRIPT_NAME'}, $job_size); + $job = C4::BackgroundJob->new($sessionID, $filename, '/cgi-bin/koha/offline_circ/process_koc.pl', $job_size); my $jobID = $job->id(); # fork off @@ -104,7 +104,7 @@ if ($completedJobID) { } else { # fork failed, so exit immediately # fork failed, so exit immediately - warn "fork failed while attempting to run $ENV{'SCRIPT_NAME'} as a background job"; + warn "fork failed while attempting to run offline_circ/process_koc.pl as a background job"; exit 0; } diff --git a/tools/batchMod.pl b/tools/batchMod.pl index af2ae4b621..055e4078a4 100755 --- a/tools/batchMod.pl +++ b/tools/batchMod.pl @@ -671,7 +671,7 @@ sub add_saved_job_results_to_template { sub put_in_background { my $job_size = shift; - my $job = C4::BackgroundJob->new($sessionID, "test", $ENV{'SCRIPT_NAME'}, $job_size); + my $job = C4::BackgroundJob->new($sessionID, "test", '/cgi-bin/koha/tools/batchMod.pl', $job_size); my $jobID = $job->id(); # fork off @@ -696,7 +696,7 @@ sub put_in_background { close STDERR; } else { # fork failed, so exit immediately - warn "fork failed while attempting to run $ENV{'SCRIPT_NAME'} as a background job"; + warn "fork failed while attempting to run tools/batchMod.pl as a background job"; exit 0; } return $job; diff --git a/tools/batch_record_modification.pl b/tools/batch_record_modification.pl index f275088533..60775a9560 100755 --- a/tools/batch_record_modification.pl +++ b/tools/batch_record_modification.pl @@ -156,7 +156,7 @@ if ( $op eq 'form' ) { my ( $job ); if ( $runinbackground ) { my $job_size = scalar( @record_ids ); - $job = C4::BackgroundJob->new( $sessionID, "FIXME", $ENV{SCRIPT_NAME}, $job_size ); + $job = C4::BackgroundJob->new( $sessionID, "FIXME", '/cgi-bin/koha/tools/batch_record_modification.pl', $job_size ); my $job_id = $job->id; if (my $pid = fork) { $dbh->{InactiveDestroy} = 1; @@ -169,7 +169,7 @@ if ( $op eq 'form' ) { close STDOUT; close STDERR; } else { - warn "fork failed while attempting to run $ENV{'SCRIPT_NAME'} as a background job"; + warn "fork failed while attempting to run tools/batch_record_modification.pl as a background job"; exit 0; } } diff --git a/tools/import_borrowers.pl b/tools/import_borrowers.pl index 15053ccd73..6d2f0c2756 100755 --- a/tools/import_borrowers.pl +++ b/tools/import_borrowers.pl @@ -106,7 +106,7 @@ if ($matchpoint) { } my $overwrite_cardnumber = $input->param('overwrite_cardnumber'); -$template->param( SCRIPT_NAME => $ENV{'SCRIPT_NAME'} ); +$template->param( SCRIPT_NAME => '/cgi-bin/koha/tools/import_borrowers.pl' ); if ( $uploadborrowers && length($uploadborrowers) > 0 ) { push @feedback, {feedback=>1, name=>'filename', value=>$uploadborrowers, filename=>$uploadborrowers}; diff --git a/tools/manage-marc-import.pl b/tools/manage-marc-import.pl index 47803c374b..b0d4f8886f 100755 --- a/tools/manage-marc-import.pl +++ b/tools/manage-marc-import.pl @@ -293,7 +293,7 @@ sub put_in_background { my $import_batch_id = shift; my $batch = GetImportBatch($import_batch_id); - my $job = C4::BackgroundJob->new($sessionID, $batch->{'file_name'}, $ENV{'SCRIPT_NAME'}, $batch->{'num_records'}); + my $job = C4::BackgroundJob->new($sessionID, $batch->{'file_name'}, '/cgi-bin/koha/tools/manage-marc-import.pl', $batch->{'num_records'}); my $jobID = $job->id(); # fork off @@ -318,7 +318,7 @@ sub put_in_background { close STDERR; } else { # fork failed, so exit immediately - warn "fork failed while attempting to run $ENV{'SCRIPT_NAME'} as a background job"; + warn "fork failed while attempting to run tools/manage-marc-import.pl as a background job"; exit 0; } return $job; diff --git a/tools/showdiffmarc.pl b/tools/showdiffmarc.pl index 488f39ef24..20abada275 100755 --- a/tools/showdiffmarc.pl +++ b/tools/showdiffmarc.pl @@ -85,7 +85,7 @@ if( $importid ) { $template->param( - SCRIPT_NAME => $ENV{'SCRIPT_NAME'}, + SCRIPT_NAME => '/cgi-bin/koha/tools/showdiffmarc.pl', BIBLIONUMBER => $biblionumber, IMPORTID => $importid, BIBLIOTITLE => $biblioTitle, diff --git a/tools/stage-marc-import.pl b/tools/stage-marc-import.pl index 1a7b587581..8d94cddb58 100755 --- a/tools/stage-marc-import.pl +++ b/tools/stage-marc-import.pl @@ -72,7 +72,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( ); $template->param( - SCRIPT_NAME => $ENV{'SCRIPT_NAME'}, + SCRIPT_NAME => '/cgi-bin/koha/tools/stage-marc-import.pl', uploadmarc => $fileID, record_type => $record_type, ); @@ -102,7 +102,7 @@ if ($completedJobID) { my $job_size = () = $marcrecord =~ /\035/g; # if we're matching, job size is doubled $job_size *= 2 if ($matcher_id ne ""); - $job = C4::BackgroundJob->new($sessionID, $filename, $ENV{'SCRIPT_NAME'}, $job_size); + $job = C4::BackgroundJob->new($sessionID, $filename, '/cgi-bin/koha/tools/stage-marc-import.pl', $job_size); my $jobID = $job->id(); # fork off @@ -121,7 +121,7 @@ if ($completedJobID) { # close STDERR; # there is no good reason to close STDERR } else { # fork failed, so exit immediately - warn "fork failed while attempting to run $ENV{'SCRIPT_NAME'} as a background job: $!"; + warn "fork failed while attempting to run tools/stage-marc-import.pl as a background job: $!"; exit 0; } -- 2.39.5