From ab6cb45b7b5d760b594e562d1e83d60e97ae6676 Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Thu, 12 May 2011 23:17:58 +0100 Subject: [PATCH] MDL-27408 fix question engine upgrade issues on MySQL. --- lib/db/upgrade.php | 5 ++--- mod/quiz/db/upgrade.php | 19 +------------------ 2 files changed, 3 insertions(+), 21 deletions(-) diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index 5317e705d8e..77fa9787c27 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -6063,12 +6063,11 @@ WHERE gradeitemid IS NOT NULL AND grademax IS NOT NULL"); } if ($oldversion < 2011051200) { - // Changing the default of field penalty on table question to 0.3333333 $table = new xmldb_table('question'); $field = new xmldb_field('penalty'); $field->set_attributes(XMLDB_TYPE_FLOAT, null, null, - XMLDB_NOTNULL, null, '0.3333333', 'defaultgrade'); + XMLDB_NOTNULL, null, '0.3333333'); // Launch change of default for field penalty $dbman->change_field_default($table, $field); @@ -6083,7 +6082,7 @@ WHERE gradeitemid IS NOT NULL AND grademax IS NOT NULL"); $table = new xmldb_table('question'); $field = new xmldb_field('defaultgrade'); $field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, - XMLDB_NOTNULL, null, '1', 'generalfeedback'); + XMLDB_NOTNULL, null, '1'); // Launch rename field defaultmark if ($dbman->field_exists($table, $field)) { diff --git a/mod/quiz/db/upgrade.php b/mod/quiz/db/upgrade.php index 258d14b74d5..ae303defd51 100644 --- a/mod/quiz/db/upgrade.php +++ b/mod/quiz/db/upgrade.php @@ -548,7 +548,7 @@ function xmldb_quiz_upgrade($oldversion) { $transaction = $DB->start_delegated_transaction(); $oldattempts = $DB->get_records_sql(' - SELECT quiza + SELECT * FROM {quiz_attempts} quiza WHERE uniqueid IN ( SELECT DISTINCT qst.attempt @@ -678,23 +678,6 @@ function xmldb_quiz_upgrade($oldversion) { upgrade_mod_savepoint(true, 2011051205, 'quiz'); } - if ($oldversion < 2011051206) { - - // Changing the default of field penalty on table question to 0.3333333 - $table = new xmldb_table('question'); - $field = new xmldb_field('penalty'); - $field->set_attributes(XMLDB_TYPE_FLOAT, null, null, - XMLDB_NOTNULL, null, '0.3333333', 'defaultgrade'); - - // Launch change of default for field penalty - $dbman->change_field_default($table, $field); - - // quiz savepoint reached - upgrade_mod_savepoint(true, 2011051206, 'quiz'); - } - -// Update the quiz from the old single review column to seven new columns. - if ($oldversion < 2011051207) { // Define field reviewattempt to be added to quiz