From: tjhunt Date: Wed, 14 Mar 2007 21:24:44 +0000 (+0000) Subject: MDL-8127 - bad use of DESCRIPTION constant in quiz module causes upgrade to fail... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=d2ab4956936c58edcd95a3fe0c30a6bbcfef6863;p=moodle.git MDL-8127 - bad use of DESCRIPTION constant in quiz module causes upgrade to fail. Thanks to Pavel Krejci for the fix. Merged from MOODLE_17_STABLE. --- diff --git a/mod/quiz/db/mysql.php b/mod/quiz/db/mysql.php index d29eaa6bd7..53bcf73273 100644 --- a/mod/quiz/db/mysql.php +++ b/mod/quiz/db/mysql.php @@ -551,7 +551,7 @@ function quiz_upgrade($oldversion) { // length of question determines question numbering. Currently all questions require one // question number except for DESCRIPTION questions. $success = $success && table_column('quiz_questions', '', 'length', 'integer', '10', 'unsigned', '1', 'not null', 'qtype'); - $success = $success && execute_sql("UPDATE {$CFG->prefix}quiz_questions SET length = 0 WHERE qtype = ".DESCRIPTION); + $success = $success && execute_sql("UPDATE {$CFG->prefix}quiz_questions SET length = 0 WHERE qtype ='7'"); } if ($success && $oldversion < 2005050408) { @@ -892,7 +892,7 @@ function quiz_upgrade($oldversion) { if ($success && $oldversion < 2006021101) { // set defaultgrade field properly (probably not necessary, but better make sure) $success = $success && execute_sql("UPDATE {$CFG->prefix}quiz_questions SET defaultgrade = '1' WHERE defaultgrade = '0'", false); - $success = $success && execute_sql("UPDATE {$CFG->prefix}quiz_questions SET defaultgrade = '0' WHERE qtype = '".DESCRIPTION."'", false); + $success = $success && execute_sql("UPDATE {$CFG->prefix}quiz_questions SET defaultgrade = '0' WHERE qtype = '7'", false); } if ($success && $oldversion < 2006021103) { diff --git a/mod/quiz/db/postgres7.php b/mod/quiz/db/postgres7.php index fb999d4bd4..d7b460e7bf 100644 --- a/mod/quiz/db/postgres7.php +++ b/mod/quiz/db/postgres7.php @@ -653,7 +653,7 @@ function quiz_upgrade($oldversion) { // length of question determines question numbering. Currently all questions require one // question number except for DESCRIPTION questions. $success = $success && table_column('quiz_questions', '', 'length', 'integer', '10', 'unsigned', '1', 'not null', 'qtype'); - $success = $success && execute_sql("UPDATE {$CFG->prefix}quiz_questions SET length = 0 WHERE qtype = ".DESCRIPTION); + $success = $success && execute_sql("UPDATE {$CFG->prefix}quiz_questions SET length = 0 WHERE qtype = '7'"); } if ($success && $oldversion < 2005050408) { @@ -994,7 +994,7 @@ function quiz_upgrade($oldversion) { if ($success && $oldversion < 2006021101) { // set defaultgrade field properly (probably not necessary, but better make sure) $success && execute_sql("UPDATE {$CFG->prefix}quiz_questions SET defaultgrade = '1' WHERE defaultgrade = '0'", false); - $success && execute_sql("UPDATE {$CFG->prefix}quiz_questions SET defaultgrade = '0' WHERE qtype = '".DESCRIPTION."'", false); + $success && execute_sql("UPDATE {$CFG->prefix}quiz_questions SET defaultgrade = '0' WHERE qtype = '7'", false); } if ($success && $oldversion < 2006021103) {