diff --git a/course/format/social/version.php b/course/format/social/version.php index 4e9200a..b4117e6 100644 --- a/course/format/social/version.php +++ b/course/format/social/version.php @@ -25,6 +25,6 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2015102100; // The current plugin version (Date: YYYYMMDDXX) +$plugin->version = 2015051100; // The current plugin version (Date: YYYYMMDDXX) $plugin->requires = 2015050500; // Requires this Moodle version $plugin->component = 'format_social'; // Full name of the plugin (used for diagnostics) diff --git a/lib/classes/plugininfo/format.php b/lib/classes/plugininfo/format.php index d0d161d..c266575 100644 --- a/lib/classes/plugininfo/format.php +++ b/lib/classes/plugininfo/format.php @@ -145,6 +145,32 @@ class format extends base { return $message; } + /** + * Returns the status of the plugin. + * + * Note this method was overriden for 29_STABLE beacuse there was a + * wrong version in format_social and we decided to fix it with a main + * upgrade step. The hack implemented here allows the installation/upgrade + * to continue normally for that exact wrong version (2015102100). + * + * See MDL-50119 for more information. + * + * @todo Delete this method in Moodle 3.0. It won't be needed anymore. + * + * @return string one of core_plugin_manager::PLUGIN_STATUS_xxx constants + */ + public function get_status() { + + // We need to intercept format_social because of MDL-50119. + if ($this->type === 'format' and $this->name === 'social' and + $this->versiondb === '2015102100' and $this->versiondisk < $this->versiondb) { + // Hack the result so we are allowed to continue and + // main upgrade does its job fixing the wrong version. + return core_plugin_manager::PLUGIN_STATUS_UPGRADE; + } + + return parent::get_status(); + } /** * Pre-uninstall hook. diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index d3c7f66..9a7429a 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -4375,5 +4375,14 @@ function xmldb_main_upgrade($oldversion) { upgrade_main_savepoint(true, 2015050401.00); } + if ($oldversion < 2015050500.02) { + // Downgrade format_social version from incorrect 2015102100 to correct 2015051100. See MDL-50119 for more info. + if (get_config('format_social', 'version') === '2015102100') { + set_config('version', '2015051100', 'format_social'); + } + + upgrade_main_savepoint(true, 2015050500.02); + } + return true; } diff --git a/version.php b/version.php index 95cd0ec..e15b4b5 100644 --- a/version.php +++ b/version.php @@ -29,7 +29,7 @@ defined('MOODLE_INTERNAL') || die(); -$version = 2015050500.01; // YYYYMMDD = weekly release date of this DEV branch. +$version = 2015050500.02; // YYYYMMDD = weekly release date of this DEV branch. // RR = release increments - 00 in DEV branches. // .XX = incremental changes.