diff options
Diffstat (limited to 'apis/cron.inc.php')
-rw-r--r-- | apis/cron.inc.php | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/apis/cron.inc.php b/apis/cron.inc.php index d00c179c..03b6201f 100644 --- a/apis/cron.inc.php +++ b/apis/cron.inc.php @@ -14,15 +14,15 @@ define('CRON_KEY_STATUS', 'cron.key.status'); define('CRON_KEY_BLOCKED', 'cron.key.blocked'); // Crash report mode - used by system crontab entry -if (($report = Request::get('crashreport', false, 'string'))) { +if (($report = Request::get('crashreport', false, 'string')) !== false) { $list = Property::getList(CRON_KEY_STATUS); if (empty($list)) { error_log('Cron crash report triggered but no cronjob marked active.'); exit(0); } $str = array(); - foreach ($list as $item) { - Property::removeFromList(CRON_KEY_STATUS, $item); + foreach ($list as $subkey => $item) { + Property::removeFromListByKey(CRON_KEY_STATUS, $subkey); $entry = explode('|', $item, 2); if (count($entry) !== 2) continue; @@ -35,7 +35,7 @@ if (($report = Request::get('crashreport', false, 'string'))) { if (empty($str)) { $str = 'an unknown module'; } - $message = 'Conjob failed. No reply by ' . implode(', ', $str); + $message = 'Cronjob failed. No reply by ' . implode(', ', $str); $details = ''; if (is_readable($report)) { $details = file_get_contents($report); @@ -62,10 +62,7 @@ function getJobStatus($id) } // Hooks by other modules -/** - * @param Hook $hook - */ -function handleModule($hook) +function handleModule(Hook $hook): void { global $cron_log_text; $cron_log_text = ''; @@ -91,13 +88,13 @@ foreach (Hook::load('cron') as $hook) { $runtime = (time() - $status['start']); if ($runtime < 0) { // Clock skew - Property::removeFromList(CRON_KEY_STATUS, $status['string']); + Property::removeFromListByVal(CRON_KEY_STATUS, $status['string']); } elseif ($runtime < 900) { // Allow up to 15 minutes for a job to complete before we complain... continue; } else { // Consider job crashed - Property::removeFromList(CRON_KEY_STATUS, $status['string']); + Property::removeFromListByVal(CRON_KEY_STATUS, $status['string']); EventLog::failure('Cronjob for module ' . $hook->moduleId . ' seems to be stuck or has crashed.'); continue; } @@ -114,5 +111,5 @@ foreach (Hook::load('cron') as $hook) { // Logging EventLog::failure('Cronjob for module ' . $hook->moduleId . ' has crashed. Check the php or web server error log.', $e->getMessage()); } - Property::removeFromList(CRON_KEY_STATUS, $value); + Property::removeFromListByVal(CRON_KEY_STATUS, $value); } |