setDescription('Removes a plugin given its name')
->addArgument('name', InputArgument::REQUIRED, 'The name of the plugin')
->addOption('keep-config', 'k', InputOption::VALUE_NONE, 'Use this flag to keep configuration');
}
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;
}
$output->write("Removing public assets...");
$this->container['plugins.assets-manager']->remove($name);
$output->writeln(" OK");
$path = $this->container['plugins.directory'] . DIRECTORY_SEPARATOR . $name;
$output->write("Removing $name...");
$this->container['filesystem']->remove($path);
$output->writeln(" OK");
$this->updateConfigFiles($input, $output);
if (!$input->getOption('keep-config')) {
$conf = $this->container['phraseanet.configuration']->getConfig();
unset($conf['plugins'][$name]);
$this->container['phraseanet.configuration']->setConfig($conf);
}
return 0;
}
}