diff --git a/lib/Alchemy/Phrasea/Command/Plugin/DisablePlugin.php b/lib/Alchemy/Phrasea/Command/Plugin/DisablePlugin.php new file mode 100644 index 0000000000..4fcfb74e94 --- /dev/null +++ b/lib/Alchemy/Phrasea/Command/Plugin/DisablePlugin.php @@ -0,0 +1,7 @@ +setDescription('Enables a plugin') + ->addArgument('name', InputArgument::REQUIRED, 'The name of the plugin'); + } + + protected function doExecutePluginAction(InputInterface $input, OutputInterface $output) + { + $name = $input->getArgument('name'); + + if (!$this->container['plugins.manager']->hasPlugin($name)) { + $output->writeln(sprintf('There is no plugin named %s, aborting', $name)); + + return 0; + } + + if ($this->container['plugins.manager']->isEnabled($name)) { + $output->writeln(sprintf('Plugin named %s is already enabled, aborting', $name)); + + return 0; + } + + $this->container['plugins.manager']->enable($name); + $output->writeln(sprintf('Plugin named %s is now enabled', $name)); + + return 0; + } +} diff --git a/lib/conf.d/plugins/autoload.php b/lib/conf.d/plugins/autoload.php index 7c242765f2..134b2dd13e 100644 --- a/lib/conf.d/plugins/autoload.php +++ b/lib/conf.d/plugins/autoload.php @@ -1,7 +1,7 @@