]> git.mjollnir.org Git - moodle.git/commitdiff
NOBUG: Fix wrong(4) default for label->introformat. Must be 0
authorstronk7 <stronk7>
Tue, 4 Aug 2009 13:57:00 +0000 (13:57 +0000)
committerstronk7 <stronk7>
Tue, 4 Aug 2009 13:57:00 +0000 (13:57 +0000)
mod/label/db/install.xml
mod/label/db/upgrade.php
mod/label/version.php

index 2f6df76f946c9051361c843eb0575aab8d1bdc3b..11f486c69806004a2fd57bb5e42656010bc17263 100644 (file)
@@ -10,7 +10,7 @@
         <FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="id" NEXT="name"/>
         <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" PREVIOUS="course" NEXT="intro"/>
         <FIELD NAME="intro" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" PREVIOUS="name" NEXT="introformat"/>
-        <FIELD NAME="introformat" TYPE="int" LENGTH="4" NOTNULL="false" UNSIGNED="true" DEFAULT="4" SEQUENCE="false" PREVIOUS="intro" NEXT="timemodified"/>
+        <FIELD NAME="introformat" TYPE="int" LENGTH="4" NOTNULL="false" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="intro" NEXT="timemodified"/>
         <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="introformat"/>
       </FIELDS>
       <KEYS>
@@ -21,4 +21,4 @@
       </INDEXES>
     </TABLE>
   </TABLES>
-</XMLDB>
\ No newline at end of file
+</XMLDB>
index 92175455684a433e3e5feefb1f9714b7a005b0b1..ccedaa53b48079d5cf493b10cee5d5fd249a5b4e 100644 (file)
@@ -51,7 +51,7 @@ function xmldb_label_upgrade($oldversion) {
 
     /// Define field introformat to be added to label
         $table = new xmldb_table('label');
-        $field = new xmldb_field('introformat', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, null, null, '4', 'intro');
+        $field = new xmldb_field('introformat', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, null, null, '0', 'intro');
 
     /// Launch add field introformat
         $dbman->add_field($table, $field);
@@ -60,6 +60,22 @@ function xmldb_label_upgrade($oldversion) {
         upgrade_mod_savepoint($result, 2009042201, 'label');
     }
 
+    if ($result && $oldversion < 2009080400) {
+
+    /// Define field introformat to be added to label
+        $table = new xmldb_table('label');
+        $field = new xmldb_field('introformat', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, null, null, '0', 'intro');
+
+    /// Launch add field introformat
+        $dbman->change_field_default($table, $field);
+
+    /// Convert existing markdown formats to 0 (due to an existing bug in early versions of label upgrade, defaulting to 4)
+        $DB->set_field('label', 'introformat', 0, array('introformat' => 4));
+
+    /// label savepoint reached
+        upgrade_mod_savepoint($result, 2009080400, 'label');
+    }
+
     return $result;
 }
 
index cb56f2d38eb48f87baf6998f4368a8bdcbb34e3f..778577b39da922afb1bbc887571f42399b8e7ff9 100644 (file)
@@ -5,7 +5,7 @@
 ///  This fragment is called by moodle_needs_upgrading() and /admin/index.php
 /////////////////////////////////////////////////////////////////////////////////
 
-$module->version  = 2009042201;  // The current module version (Date: YYYYMMDDXX)
+$module->version  = 2009080400;  // The current module version (Date: YYYYMMDDXX)
 $module->requires = 2009041700;  // Requires this Moodle version
 $module->cron     = 0;           // Period for cron to check this module (secs)