- create update.log on update in folder /install/

This commit is contained in:
Michael Kaufmann (d00p)
2010-05-17 06:09:30 +00:00
parent 785e8f0938
commit 089b03de38
4 changed files with 18 additions and 6 deletions

View File

@@ -414,13 +414,14 @@ if(isFroxlorVersion('0.9.4'))
) { ) {
showUpdateStep("Updating awstats path setting"); showUpdateStep("Updating awstats path setting");
$db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/usr/bin/' WHERE `settinggroup` = 'system' AND `varname` = 'awstats_path';"); $db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = '/usr/bin/' WHERE `settinggroup` = 'system' AND `varname` = 'awstats_path';");
lastStepStatus(0);
} }
else elseif(!isset($settings['system']['awstats_path']))
{ {
showUpdateStep("Adding new awstats path setting"); showUpdateStep("Adding new awstats path setting");
$db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('system', 'awstats_path', '/usr/bin/');"); $db->query("INSERT INTO `" . TABLE_PANEL_SETTINGS . "` (`settinggroup`, `varname`, `value`) VALUES ('system', 'awstats_path', '/usr/bin/');");
lastStepStatus(0);
} }
lastStepStatus(0);
if(isset($settings['system']['awstats_domain_file']) if(isset($settings['system']['awstats_domain_file'])
&& $settings['system']['awstats_domain_file'] != '' && $settings['system']['awstats_domain_file'] != ''

View File

@@ -89,7 +89,12 @@ if(!isFroxlor())
if(isFroxlor()) if(isFroxlor())
{ {
$filelog = FileLogger::getInstanceOf(array('loginname' => 'updater'), $db, $settings);
$filelog->setLogFile(makeCorrectFile(dirname(__FILE__).'update.log'));
$filelog->logAction(ADM_ACTION, LOG_NOTICE, '-------------- START LOG --------------');
include_once (makeCorrectFile(dirname(__FILE__).'/updates/froxlor/0.9/update_0.9.inc.php')); include_once (makeCorrectFile(dirname(__FILE__).'/updates/froxlor/0.9/update_0.9.inc.php'));
$filelog->logAction(ADM_ACTION, LOG_NOTICE, '--------------- END LOG ---------------');
unset($filelog);
} }
?> ?>

View File

@@ -169,7 +169,7 @@ class FileLogger extends AbstractLogger
} }
} }
private function setLogFile($filename = null) public function setLogFile($filename = null)
{ {
if($filename != null if($filename != null
&& $filename != '' && $filename != ''

View File

@@ -115,7 +115,7 @@ function hasUpdates($to_check = null)
*/ */
function showUpdateStep($task = null, $needs_status = true) function showUpdateStep($task = null, $needs_status = true)
{ {
global $updatelog; global $updatelog, $filelog;
// output // output
echo $task; echo $task;
@@ -126,6 +126,7 @@ function showUpdateStep($task = null, $needs_status = true)
} }
$updatelog->logAction(ADM_ACTION, LOG_WARNING, $task); $updatelog->logAction(ADM_ACTION, LOG_WARNING, $task);
$filelog->logAction(ADM_ACTION, LOG_WARNING, $task);
} }
/* /*
@@ -140,7 +141,7 @@ function showUpdateStep($task = null, $needs_status = true)
*/ */
function lastStepStatus($status = -1, $message = '') function lastStepStatus($status = -1, $message = '')
{ {
global $updatelog; global $updatelog, $filelog;
switch($status) switch($status)
{ {
@@ -164,8 +165,13 @@ function lastStepStatus($status = -1, $message = '')
// output // output
echo "<span style=\"margin-left: 5em; font-weight: bold; color: #".$status_color."\">".$status_sign."</span><br />"; echo "<span style=\"margin-left: 5em; font-weight: bold; color: #".$status_color."\">".$status_sign."</span><br />";
if($status == -1) if($status == -1 || $status == 2)
{ {
$updatelog->logAction(ADM_ACTION, LOG_WARNING, 'Attention - last update task failed!!!'); $updatelog->logAction(ADM_ACTION, LOG_WARNING, 'Attention - last update task failed!!!');
$filelog->logAction(ADM_ACTION, LOG_WARNING, 'Attention - last update task failed!!!');
}
elseif($status == 0 || $status == 1)
{
$filelog->logAction(ADM_ACTION, LOG_NOTICE, 'Success');
} }
} }