From 76d9ed010bd72fa01c39c7e66a90546d70be0c10 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Mon, 10 Apr 2017 12:03:16 +0200 Subject: [apis/cron] Try to catch exceptions when running module cron handler --- apis/cron.inc.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'apis') diff --git a/apis/cron.inc.php b/apis/cron.inc.php index 0bcd2490..cf96ac29 100644 --- a/apis/cron.inc.php +++ b/apis/cron.inc.php @@ -52,6 +52,11 @@ foreach (Hook::load('cron') as $hook) { } $value = $hook->moduleId . '|' . time(); Property::addToList(CRON_KEY_STATUS, $value, 1800); - handleModule($hook->file); + try { + handleModule($hook->file); + } catch (Exception $e) { + // Logging + EventLog::failure('Cronjob for module ' . $hook->moduleId . ' has crashed. Check the php or web server error log.', $e->toString()); + } Property::removeFromList(CRON_KEY_STATUS, $value); } -- cgit v1.2.3-55-g7522