From d5fcf4b42cc86df2d6a57e386e1d0e561e102efa Mon Sep 17 00:00:00 2001 From: Dan Poltawski Date: Tue, 16 Sep 2014 17:46:18 +0100 Subject: [PATCH] MDL-47182 admin: warn about delayed scheduled tasks Rather than using module cron, use scheduled tasks to work out if cron has been running recently. This is not perfect, the admin could disble all tasks, or reschedule them - but its not complex to compute. --- admin/index.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/admin/index.php b/admin/index.php index 34c0f95c570..8e68e44578c 100644 --- a/admin/index.php +++ b/admin/index.php @@ -555,7 +555,8 @@ if (isset($SESSION->pluginuninstallreturn)) { // Print default admin page with notifications. $errorsdisplayed = defined('WARN_DISPLAY_ERRORS_ENABLED'); -$lastcron = $DB->get_field_sql('SELECT MAX(lastcron) FROM {modules}'); +// We make the assumption that at least one schedule task should run once per day. +$lastcron = $DB->get_field_sql('SELECT MAX(lastruntime) FROM {task_scheduled}'); $cronoverdue = ($lastcron < time() - 3600 * 24); $dbproblems = $DB->diagnose(); $maintenancemode = !empty($CFG->maintenance_enabled);