Merge remote-tracking branch 'upstream/pr/705' into 3.0.x

Conflicts:
	Index/AliasProcessor.php
This commit is contained in:
Tim Nagel 2014-09-04 09:26:53 +10:00
commit 029ebb153a
4 changed files with 57 additions and 9 deletions

View file

@ -33,6 +33,7 @@ class ResetCommand extends ContainerAwareCommand
->setName('fos:elastica:reset')
->addOption('index', null, InputOption::VALUE_OPTIONAL, 'The index to reset')
->addOption('type', null, InputOption::VALUE_OPTIONAL, 'The type to reset')
->addOption('force', null, InputOption::VALUE_NONE, 'Force index deletion if same name as alias')
->setDescription('Reset search indexes')
;
}
@ -51,8 +52,9 @@ class ResetCommand extends ContainerAwareCommand
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$index = $input->getOption('index');
$type = $input->getOption('type');
$index = $input->getOption('index');
$type = $input->getOption('type');
$force = (bool) $input->getOption('force');
if (null === $index && null !== $type) {
throw new \InvalidArgumentException('Cannot specify type option without an index.');
@ -69,7 +71,7 @@ class ResetCommand extends ContainerAwareCommand
foreach ($indexes as $index) {
$output->writeln(sprintf('<info>Resetting</info> <comment>%s</comment>', $index));
$this->resetter->resetIndex($index);
$this->resetter->resetIndex($index, false, $force);
}
}
}