Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.
/lib/db/ -> tasks.php (source)

Differences Between: [Versions 310 and 402] [Versions 311 and 402] [Versions 39 and 402] [Versions 400 and 402] [Versions 401 and 402] [Versions 402 and 403]

   1  <?php
   2  // This file is part of Moodle - http://moodle.org/
   3  //
   4  // Moodle is free software: you can redistribute it and/or modify
   5  // it under the terms of the GNU General Public License as published by
   6  // the Free Software Foundation, either version 3 of the License, or
   7  // (at your option) any later version.
   8  //
   9  // Moodle is distributed in the hope that it will be useful,
  10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12  // GNU General Public License for more details.
  13  //
  14  // You should have received a copy of the GNU General Public License
  15  // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
  16  
  17  /**
  18   * Definition of core scheduled tasks.
  19   *
  20   * The handlers defined on this file are processed and registered into
  21   * the Moodle DB after any install or upgrade operation. All plugins
  22   * support this.
  23   *
  24   * @package   core
  25   * @category  task
  26   * @copyright 2013 Damyon Wiese
  27   * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  28   */
  29  
  30  defined('MOODLE_INTERNAL') || die();
  31  
  32  /* List of handlers */
  33  
  34  $tasks = array(
  35      array(
  36          'classname' => 'core\task\session_cleanup_task',
  37          'blocking' => 0,
  38          'minute' => '*',
  39          'hour' => '*',
  40          'day' => '*',
  41          'dayofweek' => '*',
  42          'month' => '*'
  43      ),
  44      array(
  45          'classname' => 'core\task\delete_unconfirmed_users_task',
  46          'blocking' => 0,
  47          'minute' => '0',
  48          'hour' => '*',
  49          'day' => '*',
  50          'dayofweek' => '*',
  51          'month' => '*'
  52      ),
  53      array(
  54          'classname' => 'core\task\delete_incomplete_users_task',
  55          'blocking' => 0,
  56          'minute' => '5',
  57          'hour' => '*',
  58          'day' => '*',
  59          'dayofweek' => '*',
  60          'month' => '*'
  61      ),
  62      array(
  63          'classname' => 'core\task\backup_cleanup_task',
  64          'blocking' => 0,
  65          'minute' => '10',
  66          'hour' => '*',
  67          'day' => '*',
  68          'dayofweek' => '*',
  69          'month' => '*'
  70      ),
  71      array(
  72          'classname' => 'core\task\tag_cron_task',
  73          'blocking' => 0,
  74          'minute' => 'R',
  75          'hour' => '3',
  76          'day' => '*',
  77          'dayofweek' => '*',
  78          'month' => '*'
  79      ),
  80      array(
  81          'classname' => 'core\task\context_cleanup_task',
  82          'blocking' => 0,
  83          'minute' => '25',
  84          'hour' => '*',
  85          'day' => '*',
  86          'dayofweek' => '*',
  87          'month' => '*'
  88      ),
  89      array(
  90          'classname' => 'core\task\cache_cleanup_task',
  91          'blocking' => 0,
  92          'minute' => '30',
  93          'hour' => '*',
  94          'day' => '*',
  95          'dayofweek' => '*',
  96          'month' => '*'
  97      ),
  98      array(
  99          'classname' => 'core\task\messaging_cleanup_task',
 100          'blocking' => 0,
 101          'minute' => '35',
 102          'hour' => '*',
 103          'day' => '*',
 104          'dayofweek' => '*',
 105          'month' => '*'
 106      ),
 107      array(
 108          'classname' => 'core\task\send_new_user_passwords_task',
 109          'blocking' => 0,
 110          'minute' => '*',
 111          'hour' => '*',
 112          'day' => '*',
 113          'dayofweek' => '*',
 114          'month' => '*'
 115      ),
 116      array(
 117          'classname' => 'core\task\send_failed_login_notifications_task',
 118          'blocking' => 0,
 119          'minute' => '*',
 120          'hour' => '*',
 121          'day' => '*',
 122          'dayofweek' => '*',
 123          'month' => '*'
 124      ),
 125      array(
 126          'classname' => 'core\task\create_contexts_task',
 127          'blocking' => 1,
 128          'minute' => '0',
 129          'hour' => '0',
 130          'day' => '*',
 131          'dayofweek' => '*',
 132          'month' => '*'
 133      ),
 134      array(
 135          'classname' => 'core\task\legacy_plugin_cron_task',
 136          'blocking' => 0,
 137          'minute' => '*',
 138          'hour' => '*',
 139          'day' => '*',
 140          'dayofweek' => '*',
 141          'month' => '*'
 142      ),
 143      array(
 144          'classname' => 'core\task\grade_cron_task',
 145          'blocking' => 0,
 146          'minute' => '*',
 147          'hour' => '*',
 148          'day' => '*',
 149          'dayofweek' => '*',
 150          'month' => '*'
 151      ),
 152      array(
 153          'classname' => 'core\task\grade_history_cleanup_task',
 154          'blocking' => 0,
 155          'minute' => '*',
 156          'hour' => '0',
 157          'day' => '*',
 158          'dayofweek' => '*',
 159          'month' => '*'
 160      ),
 161      array(
 162          'classname' => 'core\task\completion_regular_task',
 163          'blocking' => 0,
 164          'minute' => '*',
 165          'hour' => '*',
 166          'day' => '*',
 167          'dayofweek' => '*',
 168          'month' => '*'
 169      ),
 170      array(
 171          'classname' => 'core\task\completion_daily_task',
 172          'blocking' => 0,
 173          'minute' => 'R',
 174          'hour' => 'R',
 175          'day' => '*',
 176          'dayofweek' => '*',
 177          'month' => '*'
 178      ),
 179      array(
 180          'classname' => 'core\task\portfolio_cron_task',
 181          'blocking' => 0,
 182          'minute' => '*',
 183          'hour' => '*',
 184          'day' => '*',
 185          'dayofweek' => '*',
 186          'month' => '*'
 187      ),
 188      array(
 189          'classname' => 'core\task\plagiarism_cron_task',
 190          'blocking' => 0,
 191          'minute' => '*',
 192          'hour' => '*',
 193          'day' => '*',
 194          'dayofweek' => '*',
 195          'month' => '*'
 196      ),
 197      array(
 198          'classname' => 'core\task\calendar_cron_task',
 199          'blocking' => 0,
 200          'minute' => '*',
 201          'hour' => '*',
 202          'day' => '*',
 203          'dayofweek' => '*',
 204          'month' => '*'
 205      ),
 206      array(
 207          'classname' => 'core\task\blog_cron_task',
 208          'blocking' => 0,
 209          'minute' => '*',
 210          'hour' => '*',
 211          'day' => '*',
 212          'dayofweek' => '*',
 213          'month' => '*'
 214      ),
 215      array(
 216          'classname' => 'core\task\question_preview_cleanup_task',
 217          'blocking' => 0,
 218          'minute' => '*',
 219          'hour' => '*',
 220          'day' => '*',
 221          'dayofweek' => '*',
 222          'month' => '*'
 223      ),
 224      array(
 225          'classname' => 'core\task\question_stats_cleanup_task',
 226          'blocking' => 0,
 227          'minute' => '*',
 228          'hour' => '*',
 229          'day' => '*',
 230          'dayofweek' => '*',
 231          'month' => '*',
 232          'disabled' => true,
 233      ),
 234      array(
 235          'classname' => 'core\task\registration_cron_task',
 236          'blocking' => 0,
 237          'minute' => 'R',
 238          'hour' => 'R',
 239          'day' => '*',
 240          'dayofweek' => 'R',
 241          'month' => '*'
 242      ),
 243      array(
 244          'classname' => 'core\task\check_for_updates_task',
 245          'blocking' => 0,
 246          'minute' => 'R',
 247          'hour' => 'R',
 248          'day' => '*',
 249          'dayofweek' => '*',
 250          'month' => '*'
 251      ),
 252      array(
 253          'classname' => 'core\task\cache_cron_task',
 254          'blocking' => 0,
 255          'minute' => '50',
 256          'hour' => '*',
 257          'day' => '*',
 258          'dayofweek' => '*',
 259          'month' => '*'
 260      ),
 261      array(
 262          'classname' => 'core\task\automated_backup_task',
 263          'blocking' => 0,
 264          'minute' => '50',
 265          'hour' => '*',
 266          'day' => '*',
 267          'dayofweek' => '*',
 268          'month' => '*'
 269      ),
 270      array(
 271          'classname' => 'core\task\badges_cron_task',
 272          'blocking' => 0,
 273          'minute' => '*/5',
 274          'hour' => '*',
 275          'day' => '*',
 276          'dayofweek' => '*',
 277          'month' => '*'
 278      ),
 279      array(
 280          'classname' => 'core\task\badges_message_task',
 281          'blocking' => 0,
 282          'minute' => '*/5',
 283          'hour' => '*',
 284          'day' => '*',
 285          'dayofweek' => '*',
 286          'month' => '*'
 287      ),
 288      array(
 289          'classname' => 'core\task\file_temp_cleanup_task',
 290          'blocking' => 0,
 291          'minute' => '55',
 292          'hour' => '*/6',
 293          'day' => '*',
 294          'dayofweek' => '*',
 295          'month' => '*'
 296      ),
 297      array(
 298          'classname' => 'core\task\file_trash_cleanup_task',
 299          'blocking' => 0,
 300          'minute' => '55',
 301          'hour' => '*/6',
 302          'day' => '*',
 303          'dayofweek' => '*',
 304          'month' => '*'
 305      ),
 306      array(
 307          'classname' => 'core\task\search_index_task',
 308          'blocking' => 0,
 309          'minute' => '*/30',
 310          'hour' => '*',
 311          'day' => '*',
 312          'dayofweek' => '*',
 313          'month' => '*'
 314      ),
 315      array(
 316          'classname' => 'core\task\search_optimize_task',
 317          'blocking' => 0,
 318          'minute' => '15',
 319          'hour' => '*/12',
 320          'day' => '*',
 321          'dayofweek' => '*',
 322          'month' => '*'
 323      ),
 324      array(
 325          'classname' => 'core\task\stats_cron_task',
 326          'blocking' => 0,
 327          'minute' => '0',
 328          'hour' => '0',
 329          'day' => '*',
 330          'dayofweek' => '*',
 331          'month' => '*'
 332      ),
 333      array(
 334          'classname' => 'core\task\password_reset_cleanup_task',
 335          'blocking' => 0,
 336          'minute' => '0',
 337          'hour' => '*/6',
 338          'day' => '*',
 339          'dayofweek' => '*',
 340          'month' => '*'
 341      ),
 342      array(
 343          'classname' => 'core\task\complete_plans_task',
 344          'blocking' => 0,
 345          'minute' => 'R',
 346          'hour' => '*',
 347          'day' => '*',
 348          'dayofweek' => '*',
 349          'month' => '*'
 350      ),
 351      array(
 352          'classname' => 'core\task\sync_plans_from_template_cohorts_task',
 353          'blocking' => 0,
 354          'minute' => 'R',
 355          'hour' => '*',
 356          'day' => '*',
 357          'dayofweek' => '*',
 358          'month' => '*'
 359      ),
 360      array(
 361          'classname' => 'core_files\task\conversion_cleanup_task',
 362          'blocking' => 0,
 363          'minute' => 'R',
 364          'hour' => '2',
 365          'day' => '*',
 366          'dayofweek' => '*',
 367          'month' => '*'
 368      ),
 369      array(
 370          'classname' => 'core\oauth2\refresh_system_tokens_task',
 371          'blocking' => 0,
 372          'minute' => '30',
 373          'hour' => '*',
 374          'day' => '*',
 375          'dayofweek' => '*',
 376          'month' => '*'
 377      ),
 378      array(
 379          'classname' => 'core\task\analytics_cleanup_task',
 380          'blocking' => 0,
 381          'minute' => '42',
 382          'hour' => '*',
 383          'day' => '*',
 384          'dayofweek' => '*',
 385          'month' => '*'
 386      ),
 387      array(
 388          'classname' => 'core\task\task_log_cleanup_task',
 389          'blocking' => 0,
 390          'minute' => 'R',
 391          'hour' => 'R',
 392          'day' => '*',
 393          'dayofweek' => '*',
 394          'month' => '*'
 395      ),
 396      array(
 397          'classname' => 'core\task\h5p_get_content_types_task',
 398          'blocking' => 0,
 399          'minute' => 'R',
 400          'hour' => 'R',
 401          'day' => '1',
 402          'dayofweek' => '*',
 403          'month' => '*'
 404      ),
 405      array(
 406          'classname' => 'core\task\h5p_clean_orphaned_records_task',
 407          'blocking' => 0,
 408          'minute' => 'R',
 409          'hour' => '0',
 410          'day' => '*',
 411          'dayofweek' => '*',
 412          'month' => '*'
 413      ),
 414      array(
 415          'classname' => 'core\task\antivirus_cleanup_task',
 416          'blocking' => 0,
 417          'minute' => 'R',
 418          'hour' => '0',
 419          'day' => '*',
 420          'dayofweek' => '*',
 421          'month' => '*',
 422      ),
 423      array(
 424          'classname' => 'core_reportbuilder\task\send_schedules',
 425          'blocking' => 0,
 426          'minute' => '*',
 427          'hour' => '*',
 428          'day' => '*',
 429          'month' => '*',
 430          'dayofweek' => '*',
 431      ),
 432      [
 433          'classname' => 'core\task\task_lock_cleanup_task',
 434          'blocking' => 0,
 435          'minute' => 'R',
 436          'hour' => '0',
 437          'day' => '*',
 438          'dayofweek' => '*',
 439          'month' => '*'
 440      ],
 441      [
 442          'classname' => 'core_xapi\task\state_cleanup_task',
 443          'blocking' => 0,
 444          'minute' => 'R',
 445          'hour' => '0',
 446          'day' => '*',
 447          'dayofweek' => '*',
 448          'month' => '*'
 449      ],
 450  );