Permalink
Browse files

MDL-8127 - bad use of DESCRIPTION constant in quiz module causes upgr…

…ade to fail. Thanks to Pavel Krejci for the fix.
  • Loading branch information...
1 parent 52a257b commit 8ec981d1eb64d081c8d3793a3be80d2de31df39d tjhunt committed Mar 14, 2007
Showing with 4 additions and 4 deletions.
  1. +2 −2 mod/quiz/db/mysql.php
  2. +2 −2 mod/quiz/db/postgres7.php
View
@@ -546,7 +546,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) {
@@ -887,7 +887,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) {
@@ -648,7 +648,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) {
@@ -989,7 +989,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) {

0 comments on commit 8ec981d

Please sign in to comment.