diff --git a/eZ/Bundle/EzPublishCoreBundle/Command/ReindexCommand.php b/eZ/Bundle/EzPublishCoreBundle/Command/ReindexCommand.php index 8a0633d3c6..f9f6a5a45f 100644 --- a/eZ/Bundle/EzPublishCoreBundle/Command/ReindexCommand.php +++ b/eZ/Bundle/EzPublishCoreBundle/Command/ReindexCommand.php @@ -6,6 +6,7 @@ */ namespace eZ\Bundle\EzPublishCoreBundle\Command; +use Symfony\Component\Console\Style\SymfonyStyle; use function count; use const DIRECTORY_SEPARATOR; use Doctrine\DBAL\Connection; @@ -160,25 +161,25 @@ protected function configure() 'auto' )->setHelp( <<%command.name% indexes the current configured database in the configured search engine index. - - -Example usage: -- Refresh (add/update) index changes since yesterday: - ezplatform:reindex --since=yesterday - See: http://php.net/manual/en/datetime.formats.php - -- Refresh (add/update/remove) index on a set of content ID's: - ezplatform:reindex --content-ids=2,34,68 - -- Refresh (add/update) index of a subtree: - ezplatform:reindex --subtree=45 - -- Refresh (add/update) index, disabling the use of child proccesses and initial purging, - and let search engine handle commits using auto commit: - ezplatform:reindex --no-purge --no-commit --processes=0 - -EOT + The command %command.name% indexes the current configured database in the configured search engine index. + + + Example usage: + - Refresh (add/update) index changes since yesterday: + ezplatform:reindex --since=yesterday + See: http://php.net/manual/en/datetime.formats.php + + - Refresh (add/update/remove) index on a set of content ID's: + ezplatform:reindex --content-ids=2,34,68 + + - Refresh (add/update) index of a subtree: + ezplatform:reindex --subtree=45 + + - Refresh (add/update) index, disabling the use of child proccesses and initial purging, + and let search engine handle commits using auto commit: + ezplatform:reindex --no-purge --no-commit --processes=0 + + EOT ); } @@ -196,19 +197,39 @@ protected function execute(InputInterface $input, OutputInterface $output): int if (!$this->searchIndexer instanceof IncrementalIndexer) { $output->writeln(<<searchIndexer->createSearchIndex($output, (int) $iterationCount, !$commit); } else { + if (\in_array($input->getOption('processes'), ['0', '1'])) { + $io = new SymfonyStyle($input, $output); + $xdebugState = \extension_loaded('xdebug') ? 'enabled' : 'disabled'; + $memoryLimit = ini_get('memory_limit'); + + $io->warning(<<confirm('Continue?', true)) { + return 0; + } + } + $output->writeln('Re-indexing started for search engine: ' . $this->searchIndexer->getName()); $output->writeln('');