MDL-65646 core: Move component storage to json
This commit is contained in:
+14
-5
@@ -132,17 +132,26 @@ function uninstall_plugin($type, $name) {
|
||||
$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) {
|
||||
|
||||
$subpluginsfile = "{$base}/db/subplugins.json";
|
||||
if (file_exists($subpluginsfile)) {
|
||||
$subplugins = (array) json_decode(file_get_contents($subpluginsfile))->plugintypes;
|
||||
} else if (file_exists("{$base}/db/subplugins.php")) {
|
||||
debugging('Use of subplugins.php has been deprecated. ' .
|
||||
'Please update your plugin to provide a subplugins.json file instead.',
|
||||
DEBUG_DEVELOPER);
|
||||
$subplugins = [];
|
||||
include("{$base}/db/subplugins.php");
|
||||
}
|
||||
|
||||
if (!empty($subplugins)) {
|
||||
foreach (array_keys($subplugins) as $subplugintype) {
|
||||
$instances = core_component::get_plugin_list($subplugintype);
|
||||
foreach ($instances as $subpluginname => $notusedpluginpath) {
|
||||
uninstall_plugin($subplugintype, $subpluginname);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$component = $type . '_' . $name; // eg. 'qtype_multichoice' or 'workshopgrading_accumulative' or 'mod_forum'
|
||||
|
||||
Reference in New Issue
Block a user