From 5a01c2409a5a446b2891ae9bd2b45e0d0ca76edc Mon Sep 17 00:00:00 2001 From: Simey Lameze Date: Thu, 28 Mar 2019 16:15:37 +0800 Subject: [PATCH] MDL-65050 core: rename task to question_preview_cleanup_task --- lang/en/admin.php | 2 +- ...task.php => question_preview_cleanup_task.php} | 9 ++++++--- lib/db/tasks.php | 2 +- lib/db/upgrade.php | 15 +++++++++++++++ version.php | 2 +- 5 files changed, 24 insertions(+), 6 deletions(-) rename lib/classes/task/{question_cron_task.php => question_preview_cleanup_task.php} (82%) diff --git a/lang/en/admin.php b/lang/en/admin.php index 34ed615a5d3..d3f95c54946 100644 --- a/lang/en/admin.php +++ b/lang/en/admin.php @@ -1243,7 +1243,7 @@ $string['taskpasswordresetcleanup'] = 'Cleanup password reset attempts'; $string['taskplagiarismcron'] = 'Background processing for legacy cron in plagiarism plugins'; $string['taskportfoliocron'] = 'Background processing for portfolio plugins'; $string['taskprocessing'] = 'Task processing'; -$string['taskquestioncron'] = 'Background processing for question engine'; +$string['taskquestioncron'] = 'Background processing for cleaning up the old question previews'; $string['taskrefreshsystemtokens'] = 'Refresh OAuth tokens for service accounts'; $string['taskregistrationcron'] = 'Site registration'; $string['tasksendfailedloginnotifications'] = 'Send failed login notifications'; diff --git a/lib/classes/task/question_cron_task.php b/lib/classes/task/question_preview_cleanup_task.php similarity index 82% rename from lib/classes/task/question_cron_task.php rename to lib/classes/task/question_preview_cleanup_task.php index d7d9cc5063b..fc0348d4e0e 100644 --- a/lib/classes/task/question_cron_task.php +++ b/lib/classes/task/question_preview_cleanup_task.php @@ -15,7 +15,7 @@ // along with Moodle. If not, see . /** - * A scheduled task. + * Task to cleanup old question previews. * * @package core * @copyright 2013 onwards Martin Dougiamas http://dougiamas.com @@ -24,9 +24,12 @@ namespace core\task; /** - * Simple task to run the question cron. + * A task to cleanup old question previews. + * + * @copyright 2013 onwards Martin Dougiamas http://dougiamas.com + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class question_cron_task extends scheduled_task { +class question_preview_cleanup_task extends scheduled_task { /** * Get a descriptive name for this task (shown to admins). diff --git a/lib/db/tasks.php b/lib/db/tasks.php index f78f36ad534..2350af2e663 100644 --- a/lib/db/tasks.php +++ b/lib/db/tasks.php @@ -213,7 +213,7 @@ $tasks = array( 'month' => '*' ), array( - 'classname' => 'core\task\question_cron_task', + 'classname' => 'core\task\question_preview_cleanup_task', 'blocking' => 0, 'minute' => '*', 'hour' => '*', diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index 7d28a631551..a39d9ac74a9 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -2923,5 +2923,20 @@ function xmldb_main_upgrade($oldversion) { upgrade_main_savepoint(true, 2019032200.02); } + if ($oldversion < 2019032800.01) { + $sql = "UPDATE {task_scheduled} + SET classname = ? + WHERE component = ? + AND classname = ?"; + $DB->execute($sql, [ + '\core\task\question_preview_cleanup_task', + 'moodle', + '\core\task\question_cron_task' + ]); + + // Main savepoint reached. + upgrade_main_savepoint(true, 2019032800.01); + } + return true; } diff --git a/version.php b/version.php index eeaaa852057..ef8f0065184 100644 --- a/version.php +++ b/version.php @@ -29,7 +29,7 @@ defined('MOODLE_INTERNAL') || die(); -$version = 2019032800.00; // YYYYMMDD = weekly release date of this DEV branch. +$version = 2019032800.01; // YYYYMMDD = weekly release date of this DEV branch. // RR = release increments - 00 in DEV branches. // .XX = incremental changes.