quiz MDL-24727 column missed from install.xml
authorTim Hunt <T.J.Hunt@open.ac.uk>
Wed, 20 Oct 2010 10:14:19 +0000 (10:14 +0000)
committerTim Hunt <T.J.Hunt@open.ac.uk>
Wed, 20 Oct 2010 10:14:19 +0000 (10:14 +0000)
mod/quiz/db/install.xml
mod/quiz/db/upgrade.php
mod/quiz/version.php

index 2196e07..a8b4144 100755 (executable)
@@ -35,7 +35,8 @@
         <FIELD NAME="popup" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" COMMENT="Force the quiz to be attempted in a full-screen pop-up window with some evil JavaScript that attempts to prevent copying and pasting, etc." PREVIOUS="subnet" NEXT="delay1"/>
         <FIELD NAME="delay1" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" COMMENT="Enforced delay between the first and second attempts, in seconds." PREVIOUS="popup" NEXT="delay2"/>
         <FIELD NAME="delay2" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" COMMENT="Enforced delay between the second and subsequent attempts, in seconds." PREVIOUS="delay1" NEXT="showuserpicture"/>
-        <FIELD NAME="showuserpicture" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" COMMENT="Option to show the user's picture during the attempt and on the review page." PREVIOUS="delay2"/>
+        <FIELD NAME="showuserpicture" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" COMMENT="Option to show the user's picture during the attempt and on the review page." PREVIOUS="delay2" NEXT="showblocks"/>
+        <FIELD NAME="showblocks" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" COMMENT="Whether blocks should be shown on the attempt.php and review.php pages." PREVIOUS="showuserpicture"/>
       </FIELDS>
       <KEYS>
         <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
index 21290eb..ca78ed8 100644 (file)
@@ -328,16 +328,16 @@ function xmldb_quiz_upgrade($oldversion) {
 
     if ($oldversion < 2010051800) {
 
-    /// Define field showblocks to be added to quiz
+        // Define field showblocks to be added to quiz
         $table = new xmldb_table('quiz');
         $field = new xmldb_field('showblocks', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, '0', 'showuserpicture');
 
-    /// Conditionally launch add field showblocks
+        // Conditionally launch add field showblocks
         if (!$dbman->field_exists($table, $field)) {
             $dbman->add_field($table, $field);
         }
 
-    /// quiz savepoint reached
+        // quiz savepoint reached
         upgrade_mod_savepoint(true, 2010051800, 'quiz');
     }
 
@@ -356,6 +356,21 @@ function xmldb_quiz_upgrade($oldversion) {
         upgrade_mod_savepoint(true, 2010080600, 'quiz');
     }
 
+    if ($oldversion < 2010102000) {
+
+        // Define field showblocks to be added to quiz
+        // Repeat this step, because the column was missing from install.xml for a time.
+        $table = new xmldb_table('quiz');
+        $field = new xmldb_field('showblocks', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, '0', 'showuserpicture');
+
+        // Conditionally launch add field showblocks
+        if (!$dbman->field_exists($table, $field)) {
+            $dbman->add_field($table, $field);
+        }
+
+        // quiz savepoint reached
+        upgrade_mod_savepoint(true, 2010102000, 'quiz');
+    }
 
     return true;
 }
index 9cc23d7..6ff5793 100644 (file)
@@ -5,7 +5,7 @@
 //  This fragment is called by moodle_needs_upgrading() and /admin/index.php
 ////////////////////////////////////////////////////////////////////////////////
 
-$module->version  = 2010080600;   // The (date) version of this module
+$module->version  = 2010102000;   // The (date) version of this module
 $module->requires = 2010080300;   // Requires this Moodle version
 $module->cron     = 0;            // How often should cron check this module (seconds)?