Skip to content

Commit a668273

Browse files
committed
MCP-957: Parallel Indexation for Catalog Permission
-Show command when indexer is disabled;
1 parent e6f0044 commit a668273

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

app/code/Magento/Indexer/Console/Command/IndexerShowDimensionsModeCommand.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use Magento\Framework\App\ObjectManagerFactory;
1313
use Magento\Framework\App\Config\ScopeConfigInterface;
1414
use Magento\Framework\Console\Cli;
15+
use Magento\SharedCatalog\Model\State as SharedCatalogState;
1516
use Symfony\Component\Console\Input\InputArgument;
1617

1718
/**
@@ -36,26 +37,27 @@ class IndexerShowDimensionsModeCommand extends AbstractIndexerCommand
3637
* @var string[]
3738
*/
3839
private $indexers;
40+
3941
/**
40-
* @var string[]
42+
* @var SharedCatalogState
4143
*/
42-
private $optionalIndexers;
44+
private $sharedCatalogState;
4345

4446
/**
4547
* @param ObjectManagerFactory $objectManagerFactory
4648
* @param ScopeConfigInterface $configReader
49+
* @param SharedCatalogState $sharedCatalogState
4750
* @param array $indexers
48-
* @param array $optionalIndexers
4951
*/
5052
public function __construct(
5153
ObjectManagerFactory $objectManagerFactory,
5254
ScopeConfigInterface $configReader,
53-
array $indexers,
54-
array $optionalIndexers
55+
SharedCatalogState $sharedCatalogState,
56+
array $indexers
5557
) {
5658
$this->configReader = $configReader;
59+
$this->sharedCatalogState = $sharedCatalogState;
5760
$this->indexers = $indexers;
58-
$this->optionalIndexers = $optionalIndexers;
5961
parent::__construct($objectManagerFactory);
6062
}
6163

@@ -99,7 +101,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
99101
$output->writeln(sprintf('%-50s ', $indexer->getTitle() . ':') . $mode);
100102
}
101103
} catch (\Exception $e) {
102-
if (!in_array($indexerId, $this->optionalIndexers)) {
104+
if ($indexerId === 'catalogpermissions_category' && !$this->sharedCatalogState->isGlobal()) {
105+
// do nothing
106+
} else {
103107
$output->writeln('"' . $indexer->getTitle() . '" indexer process unknown error:' . PHP_EOL);
104108
$output->writeln($e->getMessage() . PHP_EOL);
105109
// we must have an exit code higher than zero to indicate something was wrong

0 commit comments

Comments
 (0)