MDL-43896 admin: Drop support for the $module syntax in version.php

This commit is contained in:
David Mudrák 2015-08-06 12:33:56 +02:00
parent e28004e614
commit 01889f019d
3 changed files with 25 additions and 6 deletions

View File

@ -288,15 +288,24 @@ class core_plugin_manager {
foreach ($plugintypes as $type => $typedir) {
$plugs = core_component::get_plugin_list($type);
foreach ($plugs as $plug => $fullplug) {
$module = new stdClass();
$plugin = new stdClass();
$plugin->version = null;
$module = $plugin;
include($fullplug.'/version.php');
// Check if the legacy $module syntax is still used.
if (!is_object($module) or (!empty((array)$module))) {
debugging('Unsupported $module syntax detected in version.php of the '.$type.'_'.$plug.' plugin.');
$skipcache = true;
}
$this->presentplugins[$type][$plug] = $plugin;
}
}
$cache->set('present', $this->presentplugins);
if (empty($skipcache)) {
$cache->set('present', $this->presentplugins);
}
}
/**

View File

@ -600,12 +600,18 @@ function upgrade_plugins_modules($startcallback, $endcallback, $verbose) {
throw new plugin_defective_exception($component, 'Missing version.php');
}
// TODO: Support for $module will end with Moodle 2.10 by MDL-43896. Was deprecated for Moodle 2.7 by MDL-43040.
$module = new stdClass();
$plugin = new stdClass();
$plugin->version = null;
$module = $plugin;
require($fullmod .'/version.php'); // Defines $plugin with version etc.
$plugin = clone($module);
// Check if the legacy $module syntax is still used.
if (!is_object($module) or (!empty((array)$module))) {
throw new plugin_defective_exception($component, 'Unsupported $module syntax detected in version.php');
}
// Prepare the record for the {modules} table.
$module = clone($plugin);
unset($module->version);
unset($module->component);
unset($module->dependencies);

View File

@ -3,7 +3,11 @@ information provided here is intended especially for developers.
=== 3.0 ===
* Function scorm_view_display was renamed to scorm_print_launch to avoid confussion with new function scorm_view.
* Dropped support for the $module in mod/xxx/version.php files (deprecated
since 2.7). All activity modules must use the $plugin syntax now. See
https://docs.moodle.org/dev/version.php for details (MDL-43896).
* Function scorm_view_display was renamed to scorm_print_launch to avoid
confussion with new function scorm_view.
=== 2.9 ===