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.

This commit is contained in:
tjhunt 2007-03-14 21:24:44 +00:00
parent 277e551b88
commit d2ab495693
2 changed files with 4 additions and 4 deletions

View File

@ -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) {

View File

@ -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) {