====== Scheduled Tasks or Cron Jobs ======
Moodle 2.7 saw the introduction of a new Task API. It's pretty straightforward, see the [[https://docs.moodle.org/dev/Task_API|official documentation]].
There's one catch, however. The ''tasks'' array entry pointing to your classname assumes that your class is in the following path: ''/[yourplugin]/classes''.
For instance, if your task file is: ''/local/expirydate/classes/task/update_visibility.php'', then you should refer to it as:
// With this as actual file location: /local/expirydate/classes/task/update_visibility.php
// Use this in /local/expirydate/db/tasks.php:
'classname' => 'local_expirydate\task\update_visibility'
This caveat is documented in ''lib/classes/component.php'', class ''core_component'', function ''classloader'':
* Class loader for Frankenstyle named classes in standard locations.
* Frankenstyle namespaces are supported.
*
* The expected location for core classes is:
* 1/ core_xx_yy_zz ---> lib/classes/xx_yy_zz.php
* 2/ \core\xx_yy_zz ---> lib/classes/xx_yy_zz.php
* 3/ \core\xx\yy_zz ---> lib/classes/xx/yy_zz.php
*
* The expected location for plugin classes is:
* 1/ mod_name_xx_yy_zz ---> mod/name/classes/xx_yy_zz.php
* 2/ \mod_name\xx_yy_zz ---> mod/name/classes/xx_yy_zz.php
* 3/ \mod_name\xx\yy_zz ---> mod/name/classes/xx/yy_zz.php