Skip to content
Extraits de code Groupes Projets
Valider 78364491 rédigé par Thomas Steur's avatar Thomas Steur Validation de Stefan Giehl
Parcourir les fichiers

add possibility to specify multiple plugins (#11733)

parent 70c9e4cb
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -10,6 +10,9 @@ The Product Changelog at **[piwik.org/changelog](http://piwik.org/changelog)** l
* The events `ScheduledTasks.shouldExecuteTask`, `ScheduledTasks.execute`, `ScheduledTasks.execute.end` have been added to customize the behaviour of scheduled tasks.
* A new event `CustomPiwikJs.shouldAddTrackerFile` has been added to let plugins customize which tracker files should be included in piwik.js JavaScript tracker
### New commands
* The commands `plugin:activate` and `plugin:deactivate` can now activate and deactivate multiple plugins at once
## Piwik 3.0.4
### New APIs
......
......@@ -23,27 +23,29 @@ class ActivatePlugin extends ConsoleCommand
{
$this->setName('plugin:activate');
$this->setDescription('Activate a plugin.');
$this->addArgument('plugin', InputArgument::REQUIRED, 'The plugin name.');
$this->addArgument('plugin', InputArgument::IS_ARRAY, 'The plugin name you want to activate. Multiple plugin names can be specified separated by a space.');
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$pluginManager = Manager::getInstance();
$plugin = $input->getArgument('plugin');
$plugins = $input->getArgument('plugin');
if ($pluginManager->isPluginActivated($plugin)) {
$output->writeln('<comment>The plugin is already activated.</comment>');
return;
}
foreach ($plugins as $plugin) {
if ($pluginManager->isPluginActivated($plugin)) {
$output->writeln(sprintf('<comment>The plugin %s is already activated.</comment>', $plugin));
continue;
}
if ($dependencies = $pluginManager->loadPlugin($plugin)->getMissingDependenciesAsString()) {
$output->writeln("<error>$dependencies</error>");
return;
}
if ($dependencies = $pluginManager->loadPlugin($plugin)->getMissingDependenciesAsString()) {
$output->writeln("<error>$dependencies</error>");
continue;
}
$pluginManager->activatePlugin($plugin);
$pluginManager->activatePlugin($plugin);
$output->writeln("Activated plugin <info>$plugin</info>");
$output->writeln("Activated plugin <info>$plugin</info>");
}
}
}
......@@ -23,22 +23,24 @@ class DeactivatePlugin extends ConsoleCommand
{
$this->setName('plugin:deactivate');
$this->setDescription('Deactivate a plugin.');
$this->addArgument('plugin', InputArgument::REQUIRED, 'The plugin name.');
$this->addArgument('plugin', InputArgument::IS_ARRAY, 'The plugin name you want to activate. Multiple plugin names can be specified separated by a space.');
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$pluginManager = Manager::getInstance();
$plugin = $input->getArgument('plugin');
$plugins = $input->getArgument('plugin');
if (!$pluginManager->isPluginActivated($plugin)) {
$output->writeln('<comment>The plugin is already deactivated.</comment>');
return;
}
foreach ($plugins as $plugin) {
if (!$pluginManager->isPluginActivated($plugin)) {
$output->writeln(sprintf('<comment>The plugin %s is already deactivated.</comment>', $plugin));
continue;
}
$pluginManager->deactivatePlugin($plugin);
$pluginManager->deactivatePlugin($plugin);
$output->writeln("Deactivated plugin <info>$plugin</info>");
$output->writeln("Deactivated plugin <info>$plugin</info>");
}
}
}
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter