$entry[1], 'string' => $item); } return false; } // Hooks by other modules function handleModule($file) { include_once $file; } foreach (Hook::load('cron') as $hook) { // Check if job is still running, or should be considered crashed $status = getJobStatus($hook->moduleId); if ($status !== false) { $runtime = (time() - $status['start']); if ($runtime < 0) { // Clock skew Property::removeFromList(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']); EventLog::failure('Cronjob for module ' . $hook->moduleId . ' seems to be stuck or has crashed. Check the php or web server error log.'); continue; } } $value = $hook . '|' . time(); Property::addToList(CRON_KEY_STATUS, $value, 1800); handleModule($hook->file); Property::removeFromList(CRON_KEY_STATUS, $value); }