MDL-51939 mod_forum: Fix groupid data on upgrade
authorAndrew Nicols <andrew@nicols.co.uk>
Wed, 28 Oct 2015 03:55:16 +0000 (11:55 +0800)
committerAndrew Nicols <andrew@nicols.co.uk>
Thu, 29 Oct 2015 13:10:11 +0000 (21:10 +0800)
This upgrade step addresses issues identified in MDL-51939 where the
groupid was incorrectly set. The issue itself is not present in 2.9, but
this upgrade step is required to correct any incorrect data.

mod/forum/db/upgrade.php
mod/forum/version.php

index ec874df..f68498f 100644 (file)
@@ -242,6 +242,13 @@ function xmldb_forum_upgrade($oldversion) {
 
     // Moodle v2.9.0 release upgrade line.
     // Put any upgrade step following this.
+    if ($oldversion < 2015102900) {
+        // Groupid = 0 is never valid.
+        $DB->set_field('forum_discussions', 'groupid', -1, array('groupid' => 0));
+
+        // Forum savepoint reached.
+        upgrade_mod_savepoint(true, 2015102900, 'forum');
+    }
 
     return true;
 }
index a6642b1..a8a7b59 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2015051103;       // The current module version (Date: YYYYMMDDXX)
+$plugin->version   = 2015102900;       // The current module version (Date: YYYYMMDDXX)
 $plugin->requires  = 2015050500;       // Requires this Moodle version
 $plugin->component = 'mod_forum';      // Full name of the plugin (used for diagnostics)