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

@ -17,6 +17,7 @@
require_once(dirname(dirname(__FILE__)) . '/config.php');
require_once($CFG->dirroot . '/repository/lib.php');
require_once($CFG->libdir . '/adminlib.php');
require_once($CFG->libdir . '/pluginlib.php');
$repository = optional_param('repos', '', PARAM_ALPHANUMEXT);
$action = optional_param('action', '', PARAM_ALPHANUMEXT);
@ -61,9 +62,6 @@ if (!empty($action)) {
require_sesskey();
}
// Purge all caches related to repositories administration.
cache::make('core', 'plugininfo_repository')->purge();
/**
* Helper function that generates a moodle_url object
* relevant to the repository
@ -151,6 +149,7 @@ if (($action == 'edit') || ($action == 'new')) {
}
if ($success) {
// configs saved
plugin_manager::reset_caches();
redirect($baseurl);
} else {
print_error('instancenotsaved', 'repository', $baseurl);
@ -191,6 +190,7 @@ if (($action == 'edit') || ($action == 'new')) {
print_error('invalidplugin', 'repository', '', $repository);
}
$repositorytype->update_visibility(true);
plugin_manager::reset_caches();
$return = true;
} else if ($action == 'hide') {
if (!confirm_sesskey()) {
@ -201,6 +201,7 @@ if (($action == 'edit') || ($action == 'new')) {
print_error('invalidplugin', 'repository', '', $repository);
}
$repositorytype->update_visibility(false);
plugin_manager::reset_caches();
$return = true;
} else if ($action == 'delete') {
$repositorytype = repository::get_type_by_typename($repository);
@ -211,6 +212,7 @@ if (($action == 'edit') || ($action == 'new')) {
}
if ($repositorytype->delete($downloadcontents)) {
plugin_manager::reset_caches();
redirect($baseurl);
} else {
print_error('instancenotdeleted', 'repository', $baseurl);