diff --git a/mod/assignment/lib.php b/mod/assignment/lib.php index efea612c883..a0d03762f8a 100644 --- a/mod/assignment/lib.php +++ b/mod/assignment/lib.php @@ -1781,6 +1781,14 @@ class assignment_base { return false; } + /** + * Plugin cron method - do not use $this here, create new assignment instances if needed. + * @return void + */ + function cron() { + //no plugin cron by default - override if needed + } + } ////// End of the assignment_base class @@ -1886,6 +1894,16 @@ function assignment_cron () { global $CFG, $USER; + /// first execute all crons in plugins + if ($plugins = get_list_of_plugins('mod/assignment/type')) { + foreach ($plugins as $plugin) { + require_once("$CFG->dirroot/mod/assignment/type/$plugin/assignment.class.php"); + $assignmentclass = "assignment_$plugin"; + $ass = new $assignmentclass(); + $ass->cron(); + } + } + /// Notices older than 1 day will not be mailed. This is to avoid the problem where /// cron has not been running for a long time, and then suddenly people are flooded /// with mail from the past few weeks or months