1 | <?php |
||
8 | class PosixProcessor implements ProcessorInterface |
||
9 | { |
||
10 | /** |
||
11 | * @inheritdoc |
||
12 | */ |
||
13 | public function isRunning(ImportPart $part) |
||
14 | { |
||
15 | if (null === $pid = $part->getProcess()) { |
||
16 | return false; |
||
17 | } |
||
18 | |||
19 | if (intval($pid) < 1) { |
||
20 | throw new \RuntimeException( |
||
21 | sprintf('Import part does not have a valid pid: %s', json_encode($pid)) |
||
22 | ); |
||
23 | } |
||
24 | |||
25 | // kill signal 0: check whether a process is running. |
||
26 | // see http://www.php.net/manual/en/function.posix-kill.php#82560 |
||
27 | return posix_kill($pid, 0); |
||
28 | } |
||
29 | |||
30 | /** |
||
31 | * @inheritdoc |
||
32 | */ |
||
33 | 4 | public function markProcessing(ImportPart $part) |
|
37 | |||
38 | /** |
||
39 | * @inheritdoc |
||
40 | */ |
||
41 | public function checkProcessing(ImportPart $part) |
||
56 | } |
||
57 |