1 | <?php |
||
35 | class ProcessCleanUpHook |
||
36 | { |
||
37 | /** |
||
38 | * @var CrawlerController |
||
39 | */ |
||
40 | private $crawlerController; |
||
41 | |||
42 | /** |
||
43 | * @var array |
||
44 | */ |
||
45 | private $extensionSettings; |
||
46 | |||
47 | /** |
||
48 | * Main function of process CleanUp Hook. |
||
49 | * |
||
50 | * @param CrawlerController $crawlerController Crawler Lib class |
||
51 | * |
||
52 | * @return void |
||
53 | */ |
||
54 | public function crawler_init(CrawlerController $crawlerController) |
||
63 | |||
64 | /** |
||
65 | * Remove active processes older than one hour |
||
66 | * |
||
67 | * @return void |
||
68 | */ |
||
69 | private function removeActiveProcessesOlderThanOneHour() |
||
87 | |||
88 | /** |
||
89 | * Removes active orphan processes from process list |
||
90 | * |
||
91 | * @return void |
||
92 | */ |
||
93 | private function removeActiveOrphanProcesses() |
||
122 | |||
123 | /** |
||
124 | * Remove a process from processlist |
||
125 | * |
||
126 | * @param string $processId Unique process Id. |
||
127 | * |
||
128 | * @return void |
||
129 | */ |
||
130 | 3 | private function removeProcessFromProcesslist($processId) |
|
143 | |||
144 | /** |
||
145 | * Create response array |
||
146 | * Convert string to array with space character as delimiter, |
||
147 | * removes all empty records to have a cleaner array |
||
148 | * |
||
149 | * @param string $string String to create array from |
||
150 | * |
||
151 | * @return array |
||
152 | * |
||
153 | */ |
||
154 | 2 | private function createResponseArray($string) |
|
160 | |||
161 | /** |
||
162 | * Check if the process still exists |
||
163 | * |
||
164 | * @param int $pid Process id to be checked. |
||
165 | * |
||
166 | * @return bool |
||
167 | * @codeCoverageIgnore |
||
168 | */ |
||
169 | private function doProcessStillExists($pid) |
||
186 | |||
187 | /** |
||
188 | * Kills a process |
||
189 | * |
||
190 | * @param int $pid Process id to kill |
||
191 | * |
||
192 | * @return void |
||
193 | * @codeCoverageIgnore |
||
194 | */ |
||
195 | private function killProcess($pid) |
||
205 | |||
206 | /** |
||
207 | * Find dispatcher processes |
||
208 | * |
||
209 | * @return array |
||
210 | * @codeCoverageIgnore |
||
211 | */ |
||
212 | private function findDispatcherProcesses() |
||
224 | |||
225 | /** |
||
226 | * Check if OS is Windows |
||
227 | * |
||
228 | * @return bool |
||
229 | * @codeCoverageIgnore |
||
230 | */ |
||
231 | private function isOsWindows() |
||
238 | |||
239 | /** |
||
240 | * @return \TYPO3\CMS\Core\Database\DatabaseConnection |
||
241 | * @codeCoverageIgnore |
||
242 | */ |
||
243 | private function getDatabaseConnection() |
||
247 | |||
248 | /** |
||
249 | * @return array|null |
||
250 | */ |
||
251 | 1 | private function getActiveProcessesOlderThanOneOHour() |
|
261 | |||
262 | /** |
||
263 | * @return array|null |
||
264 | */ |
||
265 | 1 | private function getActiveOrphanProcesses() |
|
275 | } |
||
276 |