1 | <?php |
||
29 | class AsyncReindexRunner implements ReindexRunnerInterface |
||
30 | { |
||
31 | /** |
||
32 | * @var string |
||
33 | */ |
||
34 | private const INDEXER_REINDEX_COMMAND = 'bin/magento indexer:reindex'; |
||
35 | |||
36 | /** |
||
37 | * @var ProcessFactoryInterface |
||
38 | */ |
||
39 | private $childProcessFactory; |
||
40 | |||
41 | /** |
||
42 | * @var LoopFactoryInterface |
||
43 | */ |
||
44 | private $loopFactory; |
||
45 | |||
46 | /** |
||
47 | * @var MessageBagInterface |
||
48 | */ |
||
49 | private $messageBag; |
||
50 | |||
51 | /** |
||
52 | * @var DirectoryList |
||
53 | */ |
||
54 | private $directoryList; |
||
55 | |||
56 | /** |
||
57 | * @var IndexerRegistry |
||
58 | */ |
||
59 | private $indexerRegistry; |
||
60 | |||
61 | /** |
||
62 | * AsyncReindexRunner constructor. |
||
63 | * @param ProcessFactoryInterface $childProcessFactory |
||
64 | * @param LoopFactoryInterface $loopFactory |
||
65 | * @param MessageBagInterface $messageBag |
||
66 | * @param DirectoryList $directoryList |
||
67 | * @param IndexerRegistry $indexerRegistry |
||
68 | */ |
||
69 | public function __construct( |
||
82 | |||
83 | /** |
||
84 | * {@inheritDoc} |
||
85 | */ |
||
86 | public function run(string ...$indexerIds): void |
||
101 | |||
102 | /** |
||
103 | * @param string[] ...$indexerIds |
||
104 | * @return string |
||
105 | */ |
||
106 | private function formatIndexersToBeReindex(string ...$indexerIds): string |
||
110 | |||
111 | /** |
||
112 | * @param array $indexerIds |
||
113 | * @return void |
||
114 | */ |
||
115 | private function informAboutIndexing(array $indexerIds): void |
||
121 | |||
122 | /** |
||
123 | * @return LoopInterface |
||
124 | */ |
||
125 | private function instantiateLoop(): LoopInterface |
||
129 | |||
130 | /** |
||
131 | * @param string $indexerIds |
||
132 | * @return string |
||
133 | */ |
||
134 | private function buildCommand(string $indexerIds): string |
||
143 | |||
144 | /** |
||
145 | * @return string |
||
146 | */ |
||
147 | private function getRootDir(): string |
||
151 | |||
152 | /** |
||
153 | * @param string $command |
||
154 | * @return Process |
||
155 | */ |
||
156 | private function instantiateNewProcess(string $command): Process |
||
160 | |||
161 | |||
162 | /** |
||
163 | * @param \Exception $exception |
||
164 | * @return void |
||
165 | * @throws ReindexFailureAggregateException |
||
166 | */ |
||
167 | private function handleException(\Exception $exception): void |
||
175 | } |
||
176 |