From 91d461b122ada76eff38955ed3a1e9d43a06920d Mon Sep 17 00:00:00 2001 From: "Michael Kaufmann (d00p)" Date: Mon, 1 Mar 2010 16:30:16 +0000 Subject: [PATCH] fix logging in checklastguid() when not called from cronjob --- lib/functions/system/function.checklastguid.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/functions/system/function.checklastguid.php b/lib/functions/system/function.checklastguid.php index c3957182..34f4c0e1 100644 --- a/lib/functions/system/function.checklastguid.php +++ b/lib/functions/system/function.checklastguid.php @@ -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