MDL-26943 implement subplugin support for local plugins

This commit is contained in:
Petr Škoda
2013-06-30 09:18:35 +02:00
parent 6a407a7c0e
commit 3601c5f09c
4 changed files with 95 additions and 28 deletions
+5 -4
View File
@@ -128,14 +128,15 @@ function uninstall_plugin($type, $name) {
// This may take a long time.
@set_time_limit(0);
// recursively uninstall all module/editor subplugins first
if ($type === 'mod' || $type === 'editor') {
$base = get_component_directory($type . '_' . $name);
// Recursively uninstall all subplugins first.
$subplugintypes = core_component::get_plugin_types_with_subplugins();
if (isset($subplugintypes[$type])) {
$base = core_component::get_plugin_directory($type, $name);
if (file_exists("$base/db/subplugins.php")) {
$subplugins = array();
include("$base/db/subplugins.php");
foreach ($subplugins as $subplugintype=>$dir) {
$instances = get_plugin_list($subplugintype);
$instances = core_component::get_plugin_list($subplugintype);
foreach ($instances as $subpluginname => $notusedpluginpath) {
uninstall_plugin($subplugintype, $subpluginname);
}