mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 17:36:38 +02:00
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:
parent
81881cb9d6
commit
bde002b81a
50 changed files with 1601 additions and 1940 deletions
|
@ -24,8 +24,6 @@
|
|||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once("$CFG->libdir/pluginlib.php");
|
||||
|
||||
|
||||
/**
|
||||
* Editor subplugin info class.
|
||||
|
@ -35,6 +33,34 @@ require_once("$CFG->libdir/pluginlib.php");
|
|||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class plugininfo_tinymce extends plugininfo_base {
|
||||
/**
|
||||
* Finds all enabled plugins, the result may include missing plugins.
|
||||
* @return array|null of enabled plugins $pluginname=>$pluginname, null means unknown
|
||||
*/
|
||||
public static function get_enabled_plugins() {
|
||||
$disabledsubplugins = array();
|
||||
$config = get_config('editor_tinymce', 'disabledsubplugins');
|
||||
if ($config) {
|
||||
$config = explode(',', $config);
|
||||
foreach ($config as $sp) {
|
||||
$sp = trim($sp);
|
||||
if ($sp !== '') {
|
||||
$disabledsubplugins[$sp] = $sp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$enabled = array();
|
||||
$installed = core_component::get_plugin_list('tinymce');
|
||||
foreach ($installed as $plugin => $fulldir) {
|
||||
if (isset($disabledsubplugins[$plugin])) {
|
||||
continue;
|
||||
}
|
||||
$enabled[$plugin] = $plugin;
|
||||
}
|
||||
|
||||
return $enabled;
|
||||
}
|
||||
|
||||
public function is_uninstall_allowed() {
|
||||
return true;
|
||||
|
@ -59,26 +85,6 @@ class plugininfo_tinymce extends plugininfo_base {
|
|||
$ADMIN->add($parentnodename, $settings);
|
||||
}
|
||||
}
|
||||
|
||||
public function is_enabled() {
|
||||
static $disabledsubplugins = null; // TODO: MDL-34344 remove this once get_config() is cached via MUC!
|
||||
|
||||
if (is_null($disabledsubplugins)) {
|
||||
$disabledsubplugins = array();
|
||||
$config = get_config('editor_tinymce', 'disabledsubplugins');
|
||||
if ($config) {
|
||||
$config = explode(',', $config);
|
||||
foreach ($config as $sp) {
|
||||
$sp = trim($sp);
|
||||
if ($sp !== '') {
|
||||
$disabledsubplugins[$sp] = $sp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return !isset($disabledsubplugins[$this->name]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
require(__DIR__ . '/../../../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->libdir.'/pluginlib.php');
|
||||
|
||||
$disable = optional_param('disable', '', PARAM_PLUGIN);
|
||||
$enable = optional_param('enable', '', PARAM_PLUGIN);
|
||||
|
@ -61,5 +62,6 @@ if ($disable) {
|
|||
}
|
||||
|
||||
set_config('disabledsubplugins', implode(',', $disabled), 'editor_tinymce');
|
||||
plugin_manager::reset_caches();
|
||||
|
||||
redirect($returnurl);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue