Fix #1661 : Use bin/setup for plugin manipulation to avoid plugin failures

This commit is contained in:
Romain Neutron
2014-02-03 17:24:57 +01:00
parent 142c221be2
commit a66f158dbb
6 changed files with 29 additions and 3 deletions

View File

@@ -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'));

View File

@@ -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) {

View File

@@ -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('<error> /!\ </error> <comment>Warning</comment>, this command is deprecated and will be removed as of Phraseanet 3.9, please use <info>bin/setup %s</info> instead <error> /!\ </error>', $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);

View File

@@ -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');

View File

@@ -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()) {

View File

@@ -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');