12
12
use Magento \Framework \App \ObjectManagerFactory ;
13
13
use Magento \Framework \App \Config \ScopeConfigInterface ;
14
14
use Magento \Framework \Console \Cli ;
15
+ use Magento \SharedCatalog \Model \State as SharedCatalogState ;
15
16
use Symfony \Component \Console \Input \InputArgument ;
16
17
17
18
/**
@@ -36,26 +37,27 @@ class IndexerShowDimensionsModeCommand extends AbstractIndexerCommand
36
37
* @var string[]
37
38
*/
38
39
private $ indexers ;
40
+
39
41
/**
40
- * @var string[]
42
+ * @var SharedCatalogState
41
43
*/
42
- private $ optionalIndexers ;
44
+ private $ sharedCatalogState ;
43
45
44
46
/**
45
47
* @param ObjectManagerFactory $objectManagerFactory
46
48
* @param ScopeConfigInterface $configReader
49
+ * @param SharedCatalogState $sharedCatalogState
47
50
* @param array $indexers
48
- * @param array $optionalIndexers
49
51
*/
50
52
public function __construct (
51
53
ObjectManagerFactory $ objectManagerFactory ,
52
54
ScopeConfigInterface $ configReader ,
53
- array $ indexers ,
54
- array $ optionalIndexers
55
+ SharedCatalogState $ sharedCatalogState ,
56
+ array $ indexers
55
57
) {
56
58
$ this ->configReader = $ configReader ;
59
+ $ this ->sharedCatalogState = $ sharedCatalogState ;
57
60
$ this ->indexers = $ indexers ;
58
- $ this ->optionalIndexers = $ optionalIndexers ;
59
61
parent ::__construct ($ objectManagerFactory );
60
62
}
61
63
@@ -99,7 +101,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
99
101
$ output ->writeln (sprintf ('%-50s ' , $ indexer ->getTitle () . ': ' ) . $ mode );
100
102
}
101
103
} catch (\Exception $ e ) {
102
- if (!in_array ($ indexerId , $ this ->optionalIndexers )) {
104
+ if ($ indexerId === 'catalogpermissions_category ' && !$ this ->sharedCatalogState ->isGlobal ()) {
105
+ // do nothing
106
+ } else {
103
107
$ output ->writeln ('" ' . $ indexer ->getTitle () . '" indexer process unknown error: ' . PHP_EOL );
104
108
$ output ->writeln ($ e ->getMessage () . PHP_EOL );
105
109
// we must have an exit code higher than zero to indicate something was wrong
0 commit comments