blob: 33f5671e48ea67dbe486db4b565bee977994f1a3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
<?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
namespace Piwik\Plugins\CorePluginsAdmin\Commands;
use Piwik\Plugin\ConsoleCommand;
use Piwik\Plugin\Manager;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
/**
* plugin:deactivate console command.
*/
class DeactivatePlugin extends ConsoleCommand
{
protected function configure()
{
$this->setName('plugin:deactivate');
$this->setDescription('Deactivate a plugin.');
$this->addArgument('plugin', InputArgument::REQUIRED, 'The plugin name.');
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$pluginManager = Manager::getInstance();
$plugin = $input->getArgument('plugin');
if (!$pluginManager->isPluginActivated($plugin)) {
$output->writeln('<comment>The plugin is already deactivated.</comment>');
return;
}
$pluginManager->deactivatePlugin($plugin);
$output->writeln("Deactivated plugin <info>$plugin</info>");
}
}
|