- validate our update.log file, if not writeable etc. create it in /tmp/
This commit is contained in:
@@ -19,8 +19,9 @@
|
|||||||
|
|
||||||
$updatelog = FroxlorLogger::getInstanceOf(array('loginname' => 'updater'), $db, $settings);
|
$updatelog = FroxlorLogger::getInstanceOf(array('loginname' => 'updater'), $db, $settings);
|
||||||
|
|
||||||
|
$updatelog = validateUpdateLogFile(makeCorrectFile(dirname(__FILE__).'/update.log'));
|
||||||
$filelog = FileLogger::getInstanceOf(array('loginname' => 'updater'), $settings);
|
$filelog = FileLogger::getInstanceOf(array('loginname' => 'updater'), $settings);
|
||||||
$filelog->setLogFile(makeCorrectFile(dirname(__FILE__).'/update.log'));
|
$filelog->setLogFile($updatelog);
|
||||||
$filelog->logAction(ADM_ACTION, LOG_WARNING, '-------------- START LOG --------------');
|
$filelog->logAction(ADM_ACTION, LOG_WARNING, '-------------- START LOG --------------');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -175,3 +175,25 @@ function lastStepStatus($status = -1, $message = '')
|
|||||||
$filelog->logAction(ADM_ACTION, LOG_WARNING, 'Success');
|
$filelog->logAction(ADM_ACTION, LOG_WARNING, 'Success');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* validate if full path to update.log is sane
|
||||||
|
* if not, the update.log is created in /tmp/
|
||||||
|
*
|
||||||
|
* @param string $filename the file name to validate
|
||||||
|
*
|
||||||
|
* @return string the full path with filename (can differ if not writeable => /tmp)
|
||||||
|
*/
|
||||||
|
function validateUpdateLogFile($filename)
|
||||||
|
{
|
||||||
|
if(!is_dir($filename))
|
||||||
|
{
|
||||||
|
$fh = @fopen($filename, 'a');
|
||||||
|
if($fh)
|
||||||
|
{
|
||||||
|
fclose($fh);
|
||||||
|
return $filename;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return '/tmp/froxlor_update.log';
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user