From 022b84bf7833f8147caa588bd1b3e177dae63825 Mon Sep 17 00:00:00 2001 From: "jonathan.druart@bugs.koha-community.org" 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. --- 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 21462ef..8381b1b 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 af2ae4b..055e407 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 f275088..60775a9 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 15053cc..6d2f0c2 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 47803c3..b0d4f88 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 488f39e..20abada 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 1a7b587..8d94cdd 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.1.4