MDL-30635 enable standard cron for all question and quiz plugin types.
* Support for old non-standard cron for quiz reports dropped. (Standard cron support was added in 2.2 * Cron support added for qbehaviour, qformat and quizacces plugins. * qtypes were already supported in the standard way.
This commit is contained in:
+2
-29
@@ -300,35 +300,6 @@ function cron_run() {
|
||||
mtrace('Finished blocks');
|
||||
|
||||
|
||||
//TODO: get rid of this bloody hardcoded quiz module stuff, this must be done from quiz_cron()!
|
||||
mtrace("Starting quiz reports");
|
||||
if ($reports = $DB->get_records_select('quiz_reports', "cron > 0 AND ((? - lastcron) > cron)", array($timenow))) {
|
||||
foreach ($reports as $report) {
|
||||
$cronfile = "$CFG->dirroot/mod/quiz/report/$report->name/cron.php";
|
||||
if (file_exists($cronfile)) {
|
||||
include_once($cronfile);
|
||||
$cron_function = 'quiz_report_'.$report->name."_cron";
|
||||
if (function_exists($cron_function)) {
|
||||
mtrace("Processing quiz report cron function $cron_function ...", '');
|
||||
$pre_dbqueries = null;
|
||||
$pre_dbqueries = $DB->perf_get_queries();
|
||||
$pre_time = microtime(1);
|
||||
if ($cron_function()) {
|
||||
$DB->set_field('quiz_reports', "lastcron", $timenow, array("id"=>$report->id));
|
||||
}
|
||||
if (isset($pre_dbqueries)) {
|
||||
mtrace("... used " . ($DB->perf_get_queries() - $pre_dbqueries) . " dbqueries");
|
||||
mtrace("... used " . (microtime(1) - $pre_time) . " seconds");
|
||||
}
|
||||
@set_time_limit(0);
|
||||
mtrace("done.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
mtrace("Finished quiz reports");
|
||||
|
||||
|
||||
mtrace('Starting admin reports');
|
||||
cron_execute_plugin_type('report');
|
||||
mtrace('Finished admin reports');
|
||||
@@ -428,6 +399,8 @@ function cron_run() {
|
||||
// TODO: Repository lib.php files are messed up (include many other files, etc), so it is
|
||||
// currently not possible to implement repository plugin cron using this infrastructure
|
||||
// cron_execute_plugin_type('repository', 'repository plugins');
|
||||
cron_execute_plugin_type('qbehaviour', 'question behaviours');
|
||||
cron_execute_plugin_type('qformat', 'question import/export formats');
|
||||
cron_execute_plugin_type('qtype', 'question types');
|
||||
cron_execute_plugin_type('plagiarism', 'plagiarism plugins');
|
||||
cron_execute_plugin_type('theme', 'themes');
|
||||
|
||||
Reference in New Issue
Block a user