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