Lines 7-13
use diagnostics;
Link Here
|
7 |
use C4::InstallAuth; |
7 |
use C4::InstallAuth; |
8 |
use CGI qw ( -utf8 ); |
8 |
use CGI qw ( -utf8 ); |
9 |
use POSIX qw(strftime); |
9 |
use POSIX qw(strftime); |
10 |
use File::Temp qw( tempdir ); |
|
|
11 |
|
10 |
|
12 |
use C4::Context; |
11 |
use C4::Context; |
13 |
use C4::Output; |
12 |
use C4::Output; |
Lines 323-334
elsif ( $step && $step == 3 ) {
Link Here
|
323 |
|
322 |
|
324 |
my $now = POSIX::strftime( "%Y-%m-%dT%H:%M:%S", localtime() ); |
323 |
my $now = POSIX::strftime( "%Y-%m-%dT%H:%M:%S", localtime() ); |
325 |
my $logdir = C4::Context->config('logdir'); |
324 |
my $logdir = C4::Context->config('logdir'); |
326 |
unless ( -w $logdir ) { |
325 |
my ( $logfilepath, $logfilepath_errors ) = ( chk_log($logdir, "updatedatabase_$now"), chk_log($logdir, "updatedatabase-error_$now") ); |
327 |
$logdir = tempdir; |
|
|
328 |
} |
329 |
my ( $logfilepath, $logfilepath_errors ) = ( $logdir . "/updatedatabase_$now.log", $logdir . "/updatedatabase-error_$now.log" ); |
330 |
|
326 |
|
331 |
my $cmd = C4::Context->config("intranetdir") . "/installer/data/$info{dbms}/updatedatabase.pl > $logfilepath 2> $logfilepath_errors"; |
327 |
my $cmd = C4::Context->config("intranetdir") . "/installer/data/$info{dbms}/updatedatabase.pl >> $logfilepath 2>> $logfilepath_errors"; |
332 |
|
328 |
|
333 |
system($cmd ); |
329 |
system($cmd ); |
334 |
|
330 |
|
Lines 423-425
else {
Link Here
|
423 |
} |
419 |
} |
424 |
} |
420 |
} |
425 |
output_html_with_http_headers $query, $cookie, $template->output; |
421 |
output_html_with_http_headers $query, $cookie, $template->output; |
426 |
- |
422 |
|
|
|
423 |
sub chk_log { #returns a logfile in $dir or - if that failed - in temp dir |
424 |
my ($dir, $name) = @_; |
425 |
my $fn=$dir.'/'.$name.'.log'; |
426 |
if( ! open my $fh, '>', $fn ) { |
427 |
$name.= '_XXXX'; |
428 |
require File::Temp; |
429 |
($fh, $fn)= File::Temp::tempfile( $name, TMPDIR => 1, SUFFIX => '.log'); |
430 |
#if this should not work, let croak take over |
431 |
} |
432 |
return $fn; |
433 |
} |