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