From af7d68413f2fc98cabffef2676362f62cd1758ee Mon Sep 17 00:00:00 2001 From: moodler Date: Thu, 5 Feb 2004 05:00:52 +0000 Subject: [PATCH] Update old quiz logs --- mod/quiz/db/mysql.php | 11 +++++++++++ mod/quiz/db/postgres7.php | 11 +++++++++++ mod/quiz/version.php | 4 ++-- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/mod/quiz/db/mysql.php b/mod/quiz/db/mysql.php index 4a09717559..e8cf3540f9 100644 --- a/mod/quiz/db/mysql.php +++ b/mod/quiz/db/mysql.php @@ -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; } diff --git a/mod/quiz/db/postgres7.php b/mod/quiz/db/postgres7.php index 6997247cd0..d80da9b9fd 100644 --- a/mod/quiz/db/postgres7.php +++ b/mod/quiz/db/postgres7.php @@ -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; } diff --git a/mod/quiz/version.php b/mod/quiz/version.php index 3e69b99d2d..81810f6cca 100644 --- a/mod/quiz/version.php +++ b/mod/quiz/version.php @@ -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)? ?> -- 2.39.5