MDL-41437 rework plugin_manager caching and version info in blocks and modules

This patch includes:

* version column removed from modules table, now using standard config, this allows decimal version for modules
* version column removed from block table, now using standard config, this allows decimal version for blocks
* module version.php can safely use $plugins instead of module
* new plugin_manager bulk caching, this should help with MUC performance when logged in as admin
* all missing plugins are now in plugin overview (previously only blocks and modules)
* simplified code and improved coding style
* reworked plugin_manager unit tests - now using real plugins instead of mocks
* unit tests now fail if any plugin does not contain proper version.php file
* allow uninstall of deleted filters
This commit is contained in:
Petr Škoda 2013-09-14 23:57:21 +02:00
parent 81881cb9d6
commit bde002b81a
50 changed files with 1601 additions and 1940 deletions

View file

@ -2450,5 +2450,52 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2013091300.01);
}
if ($oldversion < 2013092001.01) {
// Force uninstall of deleted tool.
if (!file_exists("$CFG->dirroot/$CFG->admin/tool/bloglevelupgrade")) {
// Remove capabilities.
capabilities_cleanup('tool_bloglevelupgrade');
// Remove all other associated config.
unset_all_config_for_plugin('tool_bloglevelupgrade');
}
upgrade_main_savepoint(true, 2013092001.01);
}
if ($oldversion < 2013092001.02) {
// Define field version to be dropped from modules.
$table = new xmldb_table('modules');
$field = new xmldb_field('version');
// Conditionally launch drop field version.
if ($dbman->field_exists($table, $field)) {
// Migrate all plugin version info to config_plugins table.
$modules = $DB->get_records('modules');
foreach ($modules as $module) {
set_config('version', $module->version, 'mod_'.$module->name);
}
unset($modules);
$dbman->drop_field($table, $field);
}
// Define field version to be dropped from block.
$table = new xmldb_table('block');
$field = new xmldb_field('version');
// Conditionally launch drop field version.
if ($dbman->field_exists($table, $field)) {
$blocks = $DB->get_records('block');
foreach ($blocks as $block) {
set_config('version', $block->version, 'block_'.$block->name);
}
unset($blocks);
$dbman->drop_field($table, $field);
}
// Main savepoint reached.
upgrade_main_savepoint(true, 2013092001.02);
}
return true;
}