From bdcdf5cf277290c7f1957fa83ebe105139a354c4 Mon Sep 17 00:00:00 2001 From: Cameron Date: Sat, 31 Dec 2022 10:12:14 -0800 Subject: [PATCH] Fixes #4933 - Cron Last-Run value missing. --- e107_handlers/cron_class.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/e107_handlers/cron_class.php b/e107_handlers/cron_class.php index 445efd87a..881fb7150 100644 --- a/e107_handlers/cron_class.php +++ b/e107_handlers/cron_class.php @@ -1190,7 +1190,8 @@ class cronScheduler try { $status = $obj->$method(); - } catch(Exception $e) + } + catch(Exception $e) { $msg = $e->getFile() . ' ' . $e->getLine(); $msg .= "\n\n" . $e->getCode() . '' . $e->getMessage(); @@ -1231,6 +1232,13 @@ class cronScheduler $this->sendMail($mail); } + $update = [ + 'cron_lastrun' => time(), + 'WHERE' => 'cron_id = '.$job['id'] + ]; + + e107::getDb()->update('cron',$update); + return $status; } @@ -1312,7 +1320,7 @@ class cronScheduler $where = 'cron_active = 1'; } - if($sql->select("cron", 'cron_function,cron_tab,cron_active', $where)) + if($sql->select("cron", 'cron_id,cron_function,cron_tab,cron_active', $where)) { while($row = $sql->fetch()) { @@ -1325,6 +1333,7 @@ class cronScheduler 'tab' => $row['cron_tab'], 'function' => $function, 'class' => $class, + 'id' => (int) $row['cron_id'] ); } }