Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormattab <matthieu.aubry@gmail.com>2014-11-13 13:40:45 +0300
committermattab <matthieu.aubry@gmail.com>2014-11-13 13:40:45 +0300
commit04b435910ca020a6034b38925afb05322f0fdb26 (patch)
treeea16f3890870a116cc8a66a2cd9e962de1a754d7 /plugins/CoreConsole
parentcab26bb5a090845e2dc78484cc1d844499e39686 (diff)
fixes #6663 New command `./console core:plugin list` will list the enabled plugins, one per line, making it easy to compare the list of plugins used in two piwik installs
Diffstat (limited to 'plugins/CoreConsole')
-rw-r--r--plugins/CoreConsole/Commands/ManagePlugin.php34
1 files changed, 32 insertions, 2 deletions
diff --git a/plugins/CoreConsole/Commands/ManagePlugin.php b/plugins/CoreConsole/Commands/ManagePlugin.php
index 0ceacbef3b..00dcd29c0a 100644
--- a/plugins/CoreConsole/Commands/ManagePlugin.php
+++ b/plugins/CoreConsole/Commands/ManagePlugin.php
@@ -26,12 +26,13 @@ class ManagePlugin extends ConsoleCommand
{
$this->setName('core:plugin');
$this->setDescription("Perform various actions regarding one or more plugins.");
- $this->addArgument("operation", InputArgument::REQUIRED, "Operation to apply (can be 'activate' or 'deactivate').");
- $this->addArgument("plugins", InputArgument::REQUIRED | InputArgument::IS_ARRAY, 'Plugin name(s) to activate.');
+ $this->addArgument("operation", InputArgument::REQUIRED, "Operation to apply (can be 'activate' or 'deactivate' or 'list').");
+ $this->addArgument("plugins", InputArgument::OPTIONAL | InputArgument::IS_ARRAY, 'Plugin name(s) to activate.');
$this->addOption('domain', null, InputOption::VALUE_REQUIRED, "The domain to activate the plugin for.");
$this->operations['activate'] = 'activatePlugin';
$this->operations['deactivate'] = 'deactivatePlugin';
+ $this->operations['list'] = 'listPlugins';
}
/**
@@ -47,6 +48,23 @@ class ManagePlugin extends ConsoleCommand
}
$fn = $this->operations[$operation];
+
+
+ if($fn == 'listPlugins') {
+ call_user_func(array($this, $fn), $input, $output);
+ } else {
+ $this->applyOperationToEachPlugin($input, $output, $plugins, $fn);
+ }
+ }
+
+ /**
+ * @param InputInterface $input
+ * @param OutputInterface $output
+ * @param $plugins
+ * @param $fn
+ */
+ protected function applyOperationToEachPlugin(InputInterface $input, OutputInterface $output, $plugins, $fn)
+ {
foreach ($plugins as $plugin) {
call_user_func(array($this, $fn), $input, $output, $plugin);
}
@@ -65,4 +83,16 @@ class ManagePlugin extends ConsoleCommand
$output->writeln("Deactivated plugin <info>$plugin</info>");
}
+
+ private function listPlugins(InputInterface $input, OutputInterface $output, $plugin)
+ {
+ $plugins = Manager::getInstance()->getPluginsLoadedAndActivated();
+
+ $count = count($plugins);
+ $output->writeln("Listing $count activated plugins:");
+ foreach($plugins as $plugin) {
+ $pluginName = $plugin->getPluginName();
+ $output->writeln("<info>$pluginName</info>");
+ };
+ }
} \ No newline at end of file