MDL-65050 core: rename task to question_preview_cleanup_task
authorSimey Lameze <simey@moodle.com>
Thu, 28 Mar 2019 08:15:37 +0000 (16:15 +0800)
committerSimey Lameze <simey@moodle.com>
Mon, 1 Apr 2019 04:57:01 +0000 (12:57 +0800)
lang/en/admin.php
lib/classes/task/question_preview_cleanup_task.php [moved from lib/classes/task/question_cron_task.php with 82% similarity]
lib/db/tasks.php
lib/db/upgrade.php
version.php

index 34ed615..d3f95c5 100644 (file)
@@ -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';
similarity index 82%
rename from lib/classes/task/question_cron_task.php
rename to lib/classes/task/question_preview_cleanup_task.php
index d7d9cc5..fc0348d 100644 (file)
@@ -15,7 +15,7 @@
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 /**
- * A scheduled task.
+ * Task to cleanup old question previews.
  *
  * @package    core
  * @copyright  2013 onwards Martin Dougiamas  http://dougiamas.com
 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).
index f78f36a..2350af2 100644 (file)
@@ -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' => '*',
index 7d28a63..a39d9ac 100644 (file)
@@ -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;
 }
index eeaaa85..ef8f006 100644 (file)
@@ -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.