From d0e6656275abfa84f3b80953302d34213af06ea0 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 19 Mar 2015 16:54:02 +0100 Subject: [PATCH] Bug 13876: Fallback to /tmp if logdir is not writable If the logdir directory is not writable by the koha user, the installer should not explode. This patch uses /tmp as a fallback. That means that the history won't be kept. Test plan: 0/ Generate an update (modify updatedatabase.pl and kohaversion) 1/ Make sure the permission are not correct on $logdir 2/ Go on the interface and execute the update entry. 3/ Confirm that the log has been created in /tmp Retry with correct permissions and confirm the log will be created in $logdir. --- installer/install.pl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/installer/install.pl b/installer/install.pl index 46f3e3a..952ed81 100755 --- a/installer/install.pl +++ b/installer/install.pl @@ -322,6 +322,9 @@ elsif ( $step && $step == 3 ) { my $now = POSIX::strftime( "%Y-%m-%dT%H:%M:%S", localtime() ); my $logdir = C4::Context->config('logdir'); + unless ( -w $logdir ) { + $logdir = '/tmp'; + } my ( $logfilepath, $logfilepath_errors ) = ( $logdir . "/updatedatabase_$now.log", $logdir . "/updatedatabase-error_$now.log" ); my $cmd = C4::Context->config("intranetdir") . "/installer/data/$info{dbms}/updatedatabase.pl > $logfilepath 2> $logfilepath_errors"; -- 2.1.0