MDL-52846 tasks: Display developer notice for legacy cron
This commit is contained in:
committed by
Eloy Lafuente (stronk7)
parent
206e179df5
commit
3bdb8f4584
@@ -27,6 +27,7 @@ namespace core\task;
|
||||
* Simple task to run cron for all plugins.
|
||||
* Note - this is only for plugins using the legacy cron method,
|
||||
* plugins can also now just add their own scheduled tasks which is the preferred method.
|
||||
* @deprecated since Moodle 3.5 - Please use new task API.
|
||||
*/
|
||||
class legacy_plugin_cron_task extends scheduled_task {
|
||||
|
||||
@@ -56,6 +57,8 @@ class legacy_plugin_cron_task extends scheduled_task {
|
||||
if (method_exists($authplugin, 'cron')) {
|
||||
mtrace("Running cron for auth/$auth...");
|
||||
$authplugin->cron();
|
||||
debugging("Use of legacy cron is deprecated (auth/$auth). Please use scheduled tasks.",
|
||||
DEBUG_DEVELOPER);
|
||||
if (!empty($authplugin->log)) {
|
||||
mtrace($authplugin->log);
|
||||
}
|
||||
@@ -74,6 +77,8 @@ class legacy_plugin_cron_task extends scheduled_task {
|
||||
}
|
||||
mtrace("Running cron for enrol_$ename...");
|
||||
$enrol->cron();
|
||||
debugging("Use of legacy cron is deprecated (enrol_$ename). Please use scheduled tasks.",
|
||||
DEBUG_DEVELOPER);
|
||||
$enrol->set_config('lastcron', time());
|
||||
}
|
||||
|
||||
@@ -91,6 +96,8 @@ class legacy_plugin_cron_task extends scheduled_task {
|
||||
$predbqueries = $DB->perf_get_queries();
|
||||
$pretime = microtime(1);
|
||||
if ($cronfunction()) {
|
||||
debugging("Use of legacy cron is deprecated ($cronfunction). Please use scheduled tasks.",
|
||||
DEBUG_DEVELOPER);
|
||||
$DB->set_field("modules", "lastcron", $timenow, array("id" => $mod->id));
|
||||
}
|
||||
if (isset($predbqueries)) {
|
||||
@@ -119,6 +126,8 @@ class legacy_plugin_cron_task extends scheduled_task {
|
||||
if (method_exists($blockobj, 'cron')) {
|
||||
mtrace("Processing cron function for ".$block->name.'....', '');
|
||||
if ($blockobj->cron()) {
|
||||
debugging("Use of legacy cron is deprecated ($classname::cron()). Please use scheduled tasks.",
|
||||
DEBUG_DEVELOPER);
|
||||
$DB->set_field('block', 'lastcron', $timenow, array('id' => $block->id));
|
||||
}
|
||||
// Reset possible changes by blocks to time_limit. MDL-11597.
|
||||
|
||||
@@ -423,6 +423,7 @@ function cron_execute_plugin_type($plugintype, $description = null) {
|
||||
}
|
||||
|
||||
mtrace('Processing cron function for ' . $component . '...');
|
||||
debugging("Use of legacy cron is deprecated ($cronfunction). Please use scheduled tasks.", DEBUG_DEVELOPER);
|
||||
cron_trace_time_and_memory();
|
||||
$pre_dbqueries = $DB->perf_get_queries();
|
||||
$pre_time = microtime(true);
|
||||
|
||||
Reference in New Issue
Block a user