Permalink
Browse files

MDL-30635 quiz cron: fixup - enable in version.php & fn name quiz_sta…

…tistics_cron
  • Loading branch information...
1 parent e516577 commit f40f4013f1a594d1b6cd56b315d12222ee4a0e11 @timhunt timhunt committed Jan 11, 2012
Showing with 11 additions and 17 deletions.
  1. +9 −15 mod/quiz/report/statistics/lib.php
  2. +2 −2 mod/quiz/version.php
@@ -51,33 +51,27 @@ function quiz_statistics_questiontext_preview_pluginfile($context, $questionid,
/**
* Quiz statistics report cron code. Deletes cached data more than a certain age.
*/
-function quiz_report_statistics_cron() {
+function quiz_statistics_cron() {
global $DB;
$expiretime = time() - 5*HOURSECS;
- $todelete = $DB->get_records_select_menu('quiz_statistics', 'timemodified < ?',
- array($expiretime), '', 'id, 1');
+ $todelete = $DB->get_records_select_menu('quiz_statistics',
+ 'timemodified < ?', array($expiretime), '', 'id, 1');
if (!$todelete) {
return true;
}
list($todeletesql, $todeleteparams) = $DB->get_in_or_equal(array_keys($todelete));
- if (!$DB->delete_records_select('quiz_question_statistics',
- 'quizstatisticsid ' . $todeletesql, $todeleteparams)) {
- mtrace('Error deleting out of date quiz_question_statistics records.');
- }
+ $DB->delete_records_select('quiz_question_statistics',
+ 'quizstatisticsid ' . $todeletesql, $todeleteparams);
- if (!$DB->delete_records_select('quiz_question_response_stats',
- 'quizstatisticsid ' . $todeletesql, $todeleteparams)) {
- mtrace('Error deleting out of date quiz_question_response_stats records.');
- }
+ $DB->delete_records_select('quiz_question_response_stats',
+ 'quizstatisticsid ' . $todeletesql, $todeleteparams);
- if (!$DB->delete_records_select('quiz_statistics',
- 'id ' . $todeletesql, $todeleteparams)) {
- mtrace('Error deleting out of date quiz_statistics records.');
- }
+ $DB->delete_records_select('quiz_statistics',
+ 'id ' . $todeletesql, $todeleteparams);
return true;
}
@@ -25,7 +25,7 @@
defined('MOODLE_INTERNAL') || die();
-$module->version = 2011112900; // The current module version (Date: YYYYMMDDXX)
+$module->version = 2011112901; // The current module version (Date: YYYYMMDDXX)
$module->requires = 2011112900; // Requires this Moodle version
$module->component = 'mod_quiz'; // Full name of the plugin (used for diagnostics)
-$module->cron = 0;
+$module->cron = 60;

0 comments on commit f40f401

Please sign in to comment.