Skip to content

Commit

Permalink
MDL-69260 admin_cli: show only contributed plugins in uninstall plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
adpe committed Jul 13, 2020
1 parent ee23a8c commit d4dc94e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions admin/cli/uninstall_plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
Options:
-h --help Print this help.
--show-all Displays a list of all installed plugins.
--show-contrib Displays a list of all third-party installed plugins.
--show-missing Displays a list of plugins missing from disk.
--purge-missing Uninstall all missing from disk plugins.
--plugins=<plugin name> A comma separated list of plugins to be uninstalled. E.g. mod_assign,mod_forum
Expand All @@ -44,6 +45,9 @@
# php uninstall_plugins.php --show-all
Prints tab-separated list of all installed plugins.
# php uninstall_plugins.php --show-contrib
Prints tab-separated list of all third-party installed plugins.
# php uninstall_plugins.php --show-missing
Prints tab-separated list of all missing from disk plugins.
Expand All @@ -63,6 +67,7 @@
list($options, $unrecognised) = cli_get_params([
'help' => false,
'show-all' => false,
'show-contrib' => false,
'show-missing' => false,
'purge-missing' => false,
'plugins' => false,
Expand All @@ -84,12 +89,15 @@
$pluginman = core_plugin_manager::instance();
$plugininfo = $pluginman->get_plugins();

if ($options['show-all'] || $options['show-missing']) {
if ($options['show-all'] || $options['show-missing'] || $options['show-contrib']) {
foreach ($plugininfo as $type => $plugins) {
foreach ($plugins as $name => $plugin) {
if ($options['show-contrib'] && $plugin->is_standard()) {
continue;
}
$pluginstring = $plugin->component . "\t" . $plugin->displayname;

if ($options['show-all']) {
if ($options['show-all'] || $options['show-contrib']) {
cli_writeln($pluginstring);
} else {
if ($plugin->get_status() === core_plugin_manager::PLUGIN_STATUS_MISSING) {
Expand Down

0 comments on commit d4dc94e

Please sign in to comment.