Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

mod-wiki MDL-25793 Fixed database discrepancies between a fresh insta…

…ll and an upgraded site within the Wiki module
  • Loading branch information...
commit 1be9192173bb70267673b790e1c9386e8789d4d6 1 parent c63ebd4
@samhemelryk samhemelryk authored
Showing with 32 additions and 1 deletion.
  1. +32 −1 mod/wiki/db/upgrade.php
View
33 mod/wiki/db/upgrade.php
@@ -64,8 +64,8 @@
* 1. Use recordset instead of record when migrating historic
* 2. Select only usefull data on block 06
*
+ * @global moodle_database $DB
*/
-
function xmldb_wiki_upgrade($oldversion) {
global $CFG, $DB, $OUTPUT;
@@ -359,6 +359,37 @@ function xmldb_wiki_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2010102800, 'wiki');
}
+
+ if ($oldversion < 2010122300) {
+ // Fix wiki in the post table after upgrade from 1.9
+ $table = new xmldb_table('wiki');
+
+ // name should default to Wiki
+ $field = new xmldb_field('name', XMLDB_TYPE_CHAR, 255, null, XMLDB_NOTNULL, null, 'Wiki', 'course');
+ if ($dbman->field_exists($table, $field)) {
+ $dbman->change_field_default($table, $field);
+ }
+
+ // timecreated field is missing after 1.9 upgrade
+ $field = new xmldb_field('timecreated', XMLDB_TYPE_INTEGER, 10, XMLDB_UNSIGNED, XMLDB_NOTNULL, null, 0, 'introformat');
+ if (!$dbman->field_exists($table, $field)) {
+ $dbman->add_field($table, $field);
+ }
+
+ // timemodified field is missing after 1.9 upgrade
+ $field = new xmldb_field('timemodified', XMLDB_TYPE_INTEGER, 10, XMLDB_UNSIGNED, XMLDB_NOTNULL, null, 0, 'timecreated');
+ if (!$dbman->field_exists($table, $field)) {
+ $dbman->add_field($table, $field);
+ }
+
+ // scaleid is not there any more
+ $field = new xmldb_field('scaleid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', null);
+ if ($dbman->field_exists($table, $field)) {
+ $dbman->drop_field($table, $field);
+ }
+
+ upgrade_mod_savepoint(true, 2010122300, 'wiki');
+ }
return true;
}
Please sign in to comment.
Something went wrong with that request. Please try again.