Update old quiz logs

This commit is contained in:
moodler 2004-02-05 05:00:52 +00:00
parent b44b3a9f29
commit af7d68413f
3 changed files with 24 additions and 2 deletions

View File

@ -181,6 +181,17 @@ function quiz_upgrade($oldversion) {
}
}
if ($oldversion < 2004020500) {
if ($quizzes = get_records("quiz")) {
foreach ($quizzes as $quiz) {
if ($cm = get_coursemodule_from_instance("quiz", $quiz->id, $quiz->course)) {
execute_sql("UPDATE {$CFG->prefix}log SET cmid = '$cm->id'
WHERE module = 'quiz' AND url = 'view.php?id=$cm->id'");
}
}
}
}
return true;
}

View File

@ -136,6 +136,17 @@ function quiz_upgrade($oldversion) {
}
}
if ($oldversion < 2004020500) {
if ($quizzes = get_records("quiz")) {
foreach ($quizzes as $quiz) {
if ($cm = get_coursemodule_from_instance("quiz", $quiz->id, $quiz->course)) {
execute_sql("UPDATE {$CFG->prefix}log SET cmid = '$cm->id'
WHERE module = 'quiz' AND url = 'view.php?id=$cm->id'");
}
}
}
}
return true;
}

View File

@ -5,8 +5,8 @@
// This fragment is called by moodle_needs_upgrading() and /admin/index.php
////////////////////////////////////////////////////////////////////////////////
$module->version = 2004013101; // The (date) version of this module
$module->requires = 2004013101; // Requires this Moodle version
$module->version = 2004020500; // The (date) version of this module
$module->requires = 2004013101; // Requires this Moodle version
$module->cron = 0; // How often should cron check this module (seconds)?
?>