fix logging in checklastguid() when not called from cronjob

This commit is contained in:
Michael Kaufmann (d00p)
2010-03-01 16:30:16 +00:00
parent 098afe7cf8
commit 91d461b122

View File

@@ -31,7 +31,14 @@
*/
function checkLastGuid($froxlor_guid = 0)
{
global $cronlog;
global $log, $cronlog;
$mylog = null;
if (isset($cronlog) && $cronlog instanceof FroxlorLogger) {
$mylog = $cronlog;
} else {
$mylog = $log;
}
$group_lines = array();
$group_guids = array();
@@ -74,19 +81,19 @@ function checkLastGuid($froxlor_guid = 0)
if($update_to_guid > $froxlor_guid)
{
$cronlog->logAction(CRON_ACTION, LOG_NOTICE, 'Updating froxlor last guid to '.$update_to_guid);
$mylog->logAction(CRON_ACTION, LOG_NOTICE, 'Updating froxlor last guid to '.$update_to_guid);
saveSetting('system', 'lastguid', $update_to_guid);
$settings['system']['lastguid'] = $update_to_guid;
}
}
else
{
$cronlog->logAction(CRON_ACTION, LOG_NOTICE, 'File /etc/group not readable; cannot check for latest guid');
$mylog->logAction(CRON_ACTION, LOG_NOTICE, 'File /etc/group not readable; cannot check for latest guid');
}
}
else
{
$cronlog->logAction(CRON_ACTION, LOG_NOTICE, 'File /etc/group not readable; cannot check for latest guid');
$mylog->logAction(CRON_ACTION, LOG_NOTICE, 'File /etc/group not readable; cannot check for latest guid');
}
}
else