From: stronk7 Date: Tue, 4 Aug 2009 13:57:00 +0000 (+0000) Subject: NOBUG: Fix wrong(4) default for label->introformat. Must be 0 X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=fe8ce24aacb3599a13e34572535abbcb962ce390;p=moodle.git NOBUG: Fix wrong(4) default for label->introformat. Must be 0 --- diff --git a/mod/label/db/install.xml b/mod/label/db/install.xml index 2f6df76f94..11f486c698 100644 --- a/mod/label/db/install.xml +++ b/mod/label/db/install.xml @@ -10,7 +10,7 @@ - + @@ -21,4 +21,4 @@ - \ No newline at end of file + diff --git a/mod/label/db/upgrade.php b/mod/label/db/upgrade.php index 9217545568..ccedaa53b4 100644 --- a/mod/label/db/upgrade.php +++ b/mod/label/db/upgrade.php @@ -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; } diff --git a/mod/label/version.php b/mod/label/version.php index cb56f2d38e..778577b39d 100644 --- a/mod/label/version.php +++ b/mod/label/version.php @@ -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)