From 4b6ad1e79beecf352d0e7a55e235354a0883ee72 Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Fri, 27 Jul 2012 16:38:14 +0100 Subject: [PATCH] MDL-32791 quiz db: clean up garbage data that was causing problems. Melinda Kraft reported having rows in their quiz_question_instances table which caused various problems. These rows are meaningless, so I have done a DB upgrade step to clean them up, which should deal with the bad side-effets they were causing. --- mod/quiz/db/upgrade.php | 10 ++++++++++ mod/quiz/version.php | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/mod/quiz/db/upgrade.php b/mod/quiz/db/upgrade.php index b0a4a4f4a95..3bbbb6d4d83 100644 --- a/mod/quiz/db/upgrade.php +++ b/mod/quiz/db/upgrade.php @@ -330,6 +330,16 @@ function xmldb_quiz_upgrade($oldversion) { // Moodle v2.3.0 release upgrade line // Put any upgrade step following this + if ($oldversion < 2012061702) { + + // MDL-32791 somebody reported having nonsense rows in their + // quiz_question_instances which caused various problems. These rows + // are meaningless, hence this upgrade step to clean them up. + $DB->delete_records('quiz_question_instances', array('question' => 0)); + + // Quiz savepoint reached. + upgrade_mod_savepoint(true, 2012061702, 'quiz'); + } return true; } diff --git a/mod/quiz/version.php b/mod/quiz/version.php index 03f42f1d58f..67ca371213d 100644 --- a/mod/quiz/version.php +++ b/mod/quiz/version.php @@ -25,7 +25,7 @@ defined('MOODLE_INTERNAL') || die(); -$module->version = 2012061701; // The current module version (Date: YYYYMMDDXX). +$module->version = 2012061702; // The current module version (Date: YYYYMMDDXX). $module->requires = 2012061700; // Requires this Moodle version. $module->component = 'mod_quiz'; // Full name of the plugin (used for diagnostics). $module->cron = 60;