diff --git a/bin/setup b/bin/setup index 8bf9f6f669..868681ea50 100755 --- a/bin/setup +++ b/bin/setup @@ -20,6 +20,9 @@ use Alchemy\Phrasea\Core\Version; use Alchemy\Phrasea\Command\UpgradeDBDatas; use Alchemy\Phrasea\Command\Setup\Install; use Alchemy\Phrasea\Command\Setup\PluginsReset; +use Alchemy\Phrasea\Command\Plugin\ListPlugin; +use Alchemy\Phrasea\Command\Plugin\AddPlugin; +use Alchemy\Phrasea\Command\Plugin\RemovePlugin; use Alchemy\Phrasea\CLI; use Alchemy\Phrasea\Command\Setup\CheckEnvironment; @@ -60,6 +63,9 @@ if ($app['phraseanet.configuration-tester']->isInstalled()) { $app->command(new UpgradeDBDatas('system:upgrade-datas')); } +$app->command(new AddPlugin()); +$app->command(new ListPlugin()); +$app->command(new RemovePlugin()); $app->command(new PluginsReset()); $app->command(new CheckEnvironment('check:system')); $app->command(new Install('system:install')); diff --git a/lib/Alchemy/Phrasea/CLI.php b/lib/Alchemy/Phrasea/CLI.php index 2a81f1356f..cf0fa99fd6 100644 --- a/lib/Alchemy/Phrasea/CLI.php +++ b/lib/Alchemy/Phrasea/CLI.php @@ -76,6 +76,13 @@ class CLI extends Application $app->run(); } + public function boot() + { + parent::boot(); + + $this['console']->setDispatcher($this['dispatcher']); + } + public function run(\Symfony\Component\HttpFoundation\Request $request = null) { if (null !== $request) { diff --git a/lib/Alchemy/Phrasea/Command/Plugin/AbstractPluginCommand.php b/lib/Alchemy/Phrasea/Command/Plugin/AbstractPluginCommand.php index 7f528991c9..5a259e9a92 100644 --- a/lib/Alchemy/Phrasea/Command/Plugin/AbstractPluginCommand.php +++ b/lib/Alchemy/Phrasea/Command/Plugin/AbstractPluginCommand.php @@ -30,6 +30,19 @@ abstract class AbstractPluginCommand extends Command return $manifests; } + protected function doExecute(InputInterface $input, OutputInterface $output) + { + if (basename($_SERVER['PHP_SELF']) === 'console') { + $output->writeln(""); + $output->writeln(sprintf(' /!\ Warning, this command is deprecated and will be removed as of Phraseanet 3.9, please use bin/setup %s instead /!\ ', $this->getName())); + $output->writeln(""); + } + + return $this->doExecutePluginAction($input, $output); + } + + abstract protected function doExecutePluginAction(InputInterface $input, OutputInterface $output); + protected function updateConfigFiles(InputInterface $input, OutputInterface $output) { $manifests = $this->validatePlugins($input, $output); diff --git a/lib/Alchemy/Phrasea/Command/Plugin/AddPlugin.php b/lib/Alchemy/Phrasea/Command/Plugin/AddPlugin.php index ebb9930e13..cd223e22b0 100644 --- a/lib/Alchemy/Phrasea/Command/Plugin/AddPlugin.php +++ b/lib/Alchemy/Phrasea/Command/Plugin/AddPlugin.php @@ -26,7 +26,7 @@ class AddPlugin extends AbstractPluginCommand ->addArgument('source', InputArgument::REQUIRED, 'The source is a folder'); } - protected function doExecute(InputInterface $input, OutputInterface $output) + protected function doExecutePluginAction(InputInterface $input, OutputInterface $output) { $source = $input->getArgument('source'); diff --git a/lib/Alchemy/Phrasea/Command/Plugin/ListPlugin.php b/lib/Alchemy/Phrasea/Command/Plugin/ListPlugin.php index db269b02ef..0b6eee9070 100644 --- a/lib/Alchemy/Phrasea/Command/Plugin/ListPlugin.php +++ b/lib/Alchemy/Phrasea/Command/Plugin/ListPlugin.php @@ -27,7 +27,7 @@ class ListPlugin extends AbstractPluginCommand ->addOption('json', 'j', InputOption::VALUE_NONE, 'Output result in JSON'); } - protected function doExecute(InputInterface $input, OutputInterface $output) + protected function doExecutePluginAction(InputInterface $input, OutputInterface $output) { $plugins = array_map(function (Plugin $plugin) use ($input) { if ($plugin->isErroneous()) { diff --git a/lib/Alchemy/Phrasea/Command/Plugin/RemovePlugin.php b/lib/Alchemy/Phrasea/Command/Plugin/RemovePlugin.php index e6625ef56c..109e205e4f 100644 --- a/lib/Alchemy/Phrasea/Command/Plugin/RemovePlugin.php +++ b/lib/Alchemy/Phrasea/Command/Plugin/RemovePlugin.php @@ -26,7 +26,7 @@ class RemovePlugin extends AbstractPluginCommand ->addArgument('name', InputArgument::REQUIRED, 'The name of the plugin'); } - protected function doExecute(InputInterface $input, OutputInterface $output) + protected function doExecutePluginAction(InputInterface $input, OutputInterface $output) { $name = $input->getArgument('name');