Commit 9859e26c authored by jamiesensei's avatar jamiesensei
Browse files

MDL-14208 "add cron routine to clean up cache records"

parent d1789d5d
<?php // $Id$
function quiz_report_statistics_cron(){
global $DB;
if ($todelete = $DB->get_records_select_menu('quiz_statistics', 'timemodified < ?', array(time()-5*HOURSECS))){
list($todeletesql, $todeleteparams) = $DB->get_in_or_equal($todelete);
if (!$DB->delete_records_select('quiz_statistics', "id $todeletesql", $todeleteparams)){
mtrace('Error deleting out of date quiz_statistics records.');
}
if (!$DB->delete_records_select('quiz_question_statistics', "quizstatisticsid $todeletesql", $todeleteparams)){
mtrace('Error deleting out of date quiz_question_statistics records.');
}
}
return true;
}
?>
<?php // $Id$
function xmldb_quizreport_statistics_upgrade($oldversion=0) {
global $DB;
$dbman = $DB->get_manager();
$result = true;
//===== 1.9.0 upgrade line ======//
if ($result && $oldversion < 2008072401) {
//register cron to run every 5 hours.
$result = $result && $DB->set_field('quiz_report', 'cron', HOURSECS*5, array('name'=>'statistics'));
}
return $result;
}
?>
<?php
$plugin->version = 2008072400; // The (date) version of this module
$plugin->version = 2008072401; // The (date) version of this module
?>
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment