mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 12:40:01 +01:00
MDL-10927 implemented cron support in assignment plugins
This commit is contained in:
parent
1fc8777426
commit
d014b69b92
@ -1781,6 +1781,14 @@ class assignment_base {
|
|||||||
return false;
|
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
|
} ////// End of the assignment_base class
|
||||||
|
|
||||||
|
|
||||||
@ -1886,6 +1894,16 @@ function assignment_cron () {
|
|||||||
|
|
||||||
global $CFG, $USER;
|
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
|
/// 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
|
/// cron has not been running for a long time, and then suddenly people are flooded
|
||||||
/// with mail from the past few weeks or months
|
/// with mail from the past few weeks or months
|
||||||
|
Loading…
x
Reference in New Issue
Block a user