From 9e8b23679c48a157dc2f0bcd19a6de05bfb2fcac Mon Sep 17 00:00:00 2001 From: brantje Date: Sat, 1 Oct 2016 17:52:53 +0200 Subject: [PATCH] More loggin for the cron, less strict checking --- lib/Service/CronService.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/Service/CronService.php b/lib/Service/CronService.php index d599a5ab..8b5b246a 100644 --- a/lib/Service/CronService.php +++ b/lib/Service/CronService.php @@ -42,14 +42,20 @@ class CronService { $sql = 'SELECT count(*) as rows from `*PREFIX*notifications` WHERE `subject`= \'credential_expired\' AND object_id=?'; $query = $this->db->prepareQuery($sql); - $query->bindParam(1, $credential->getId(), \PDO::PARAM_INT); + $id = $credential->getId(); + $query->bindParam(1, $id, \PDO::PARAM_INT); $result = $query->execute(); - if($result->fetchRow()['rows'] === 0) { + $this->logger->debug($credential->getLabel() .' is expired, checking notifications!', array('app' => 'passman')); + if($result->fetchRow()['rows'] == 0) { + $this->logger->debug($credential->getLabel() .' is expired, adding notification!', array('app' => 'passman')); + $this->activityService->add( Activity::SUBJECT_ITEM_EXPIRED, array($credential->getLabel(), $credential->getUserId()), '', array(), $link, $credential->getUserId(), Activity::TYPE_ITEM_EXPIRED); $this->notificationService->credentialExpiredNotification($credential); + } else { + $this->logger->debug($credential->getLabel() .' is expired, already notified!', array('app' => 'passman')); } }