|
1 |
| ---- Console/Command/IndexerReindexCommand.php.origin 2020-01-10 06:20:40.000000000 +0300 |
2 |
| -+++ Console/Command/IndexerReindexCommand.php 2020-04-20 17:52:02.188753742 +0300 |
| 1 | +--- Console/Command/IndexerReindexCommand.php |
| 2 | ++++ Console/Command/IndexerReindexCommand.php |
3 | 3 | @@ -22,6 +22,8 @@
|
4 | 4 | */
|
5 | 5 | class IndexerReindexCommand extends AbstractIndexerManageCommand
|
|
9 | 9 | /**
|
10 | 10 | * @var array
|
11 | 11 | */
|
12 |
| -@@ -66,6 +68,14 @@ |
| 12 | +@@ -66,6 +68,13 @@ |
13 | 13 | ->setDescription('Reindexes Data')
|
14 | 14 | ->setDefinition($this->getInputList());
|
15 | 15 |
|
16 | 16 | + $this->addOption(
|
17 | 17 | + static::INPUT_OPTION_WITH_DEPENDENCIES,
|
18 | 18 | + null,
|
19 |
| -+ \Symfony\Component\Console\Input\InputArgument::OPTIONAL, |
20 |
| -+ 'Reindex also dependent and related indexers (default Magento 2 behavior)', |
21 |
| -+ false |
| 19 | ++ \Symfony\Component\Console\Input\InputOption::VALUE_NONE, |
| 20 | ++ 'Reindex also dependent and related indexers (default Magento 2 behavior)' |
22 | 21 | + );
|
23 | 22 | +
|
24 | 23 | parent::configure();
|
25 | 24 | }
|
26 | 25 |
|
27 |
| -@@ -74,6 +84,28 @@ |
| 26 | +@@ -74,6 +83,13 @@ |
28 | 27 | */
|
29 | 28 | protected function execute(InputInterface $input, OutputInterface $output)
|
30 | 29 | {
|
31 | 30 | + $withDependencies = $this->isWithDependencies($input);
|
32 | 31 | +
|
33 | 32 | + if (!$withDependencies) {
|
34 |
| -+ $output->writeln('<warning>You are going to run reindex without dependencies.</warning>'); |
35 |
| -+ $output->writeln('<warning>Dependent and related indexers will be skipped.</warning>'); |
36 |
| -+ $output->writeln('Use <info>--with-dependencies=1</info> to reindex with dependent and related indexers.'); |
37 |
| -+ |
38 |
| -+ /** @var \Symfony\Component\Console\Helper\QuestionHelper $questionHelper */ |
39 |
| -+ $questionHelper = $this->getHelper('question'); |
40 |
| -+ |
41 |
| -+ $answer = $questionHelper->ask($input, $output, new \Symfony\Component\Console\Question\Question( |
42 |
| -+ "Continue? [yes/<info>no</info>] > ", |
43 |
| -+ 'no' |
44 |
| -+ )); |
45 |
| -+ |
46 |
| -+ if (strpos($answer, 'y') !== 0) { |
47 |
| -+ $output->writeln('Skipped.'); |
48 |
| -+ |
49 |
| -+ return \Magento\Framework\Console\Cli::RETURN_FAILURE; |
50 |
| -+ } |
| 33 | ++ $output->writeln('<info>Dependent and related indexers will be ingored.</info>'); |
| 34 | ++ $output->writeln('Use <info>--with-dependencies</info> to reindex with dependent and related indexers.'); |
51 | 35 | + }
|
52 | 36 | +
|
53 | 37 | $returnValue = Cli::RETURN_FAILURE;
|
54 | 38 | foreach ($this->getIndexers($input) as $indexer) {
|
55 | 39 | try {
|
56 |
| -@@ -119,15 +151,19 @@ |
| 40 | +@@ -119,15 +135,19 @@ |
57 | 41 |
|
58 | 42 | $relatedIndexers = [];
|
59 | 43 | $dependentIndexers = [];
|
|
82 | 66 | }
|
83 | 67 |
|
84 | 68 | $invalidRelatedIndexers = [];
|
85 |
| -@@ -300,4 +336,15 @@ |
| 69 | +@@ -300,4 +320,15 @@ |
86 | 70 | }
|
87 | 71 | return $this->dependencyInfoProvider;
|
88 | 72 | }
|
|
0 commit comments