mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 15:33:15 +00:00
Add "--force" option to index drop command
This commit is contained in:
@@ -14,6 +14,7 @@ namespace Alchemy\Phrasea\Command\SearchEngine;
|
|||||||
use Alchemy\Phrasea\Command\Command;
|
use Alchemy\Phrasea\Command\Command;
|
||||||
use Alchemy\Phrasea\SearchEngine\Elastic\Indexer;
|
use Alchemy\Phrasea\SearchEngine\Elastic\Indexer;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
|
||||||
class IndexDropCommand extends Command
|
class IndexDropCommand extends Command
|
||||||
@@ -23,6 +24,12 @@ class IndexDropCommand extends Command
|
|||||||
$this
|
$this
|
||||||
->setName('searchengine:index:drop')
|
->setName('searchengine:index:drop')
|
||||||
->setDescription('Deletes the search index')
|
->setDescription('Deletes the search index')
|
||||||
|
->addOption(
|
||||||
|
'force',
|
||||||
|
null,
|
||||||
|
InputOption::VALUE_NONE,
|
||||||
|
"Don't ask for for the dropping of the index, but force the operation to run."
|
||||||
|
)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -30,7 +37,11 @@ class IndexDropCommand extends Command
|
|||||||
{
|
{
|
||||||
|
|
||||||
$question = '<question>You are about to delete the index and all contained data. Are you sure you wish to continue? (y/n)</question>';
|
$question = '<question>You are about to delete the index and all contained data. Are you sure you wish to continue? (y/n)</question>';
|
||||||
$confirmation = $this->getHelper('dialog')->askConfirmation($output, $question, false);
|
if ($input->getOption('force')) {
|
||||||
|
$confirmation = true;
|
||||||
|
} else {
|
||||||
|
$confirmation = $this->getHelper('dialog')->askConfirmation($output, $question, false);
|
||||||
|
}
|
||||||
|
|
||||||
if ($confirmation) {
|
if ($confirmation) {
|
||||||
$indexer = $this->container['elasticsearch.indexer'];
|
$indexer = $this->container['elasticsearch.indexer'];
|
||||||
|
Reference in New Issue
Block a user