From 9eeb088734b112684295d22fc0961adc03ef3db5 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Fri, 7 Jun 2013 20:15:23 +0200 Subject: [PATCH] check if notifications exist at all --- cronjobs/notifications.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/cronjobs/notifications.php b/cronjobs/notifications.php index 45bda82a..aa2bf8a9 100755 --- a/cronjobs/notifications.php +++ b/cronjobs/notifications.php @@ -46,16 +46,17 @@ if (empty($aWorkers)) { // We notified, lets check which recovered $aNotifications = $notification->getAllActive(); -foreach ($aNotifications as $aNotification) { - $aData = json_decode($aNotification['data'], true); - $aWorker = $worker->getWorker($aData['id']); - if ($aWorker['active'] == 1) { - if ($notification->setInactive($aNotification['id'])) { - verbose("Marked notification " . $aNotification['id'] . " as inactive\n"); - } else { - verbose("Failed to set notification inactive for " . $aWorker['username'] . "\n"); +if (!empty($aNotifications)) { + foreach ($aNotifications as $aNotification) { + $aData = json_decode($aNotification['data'], true); + $aWorker = $worker->getWorker($aData['id']); + if ($aWorker['active'] == 1) { + if ($notification->setInactive($aNotification['id'])) { + verbose("Marked notification " . $aNotification['id'] . " as inactive\n"); + } else { + verbose("Failed to set notification inactive for " . $aWorker['username'] . "\n"); + } } } } - ?>