| @@ 66-80 (lines=15) @@ | ||
| 63 | $this->fire(); |
|
| 64 | } |
|
| 65 | ||
| 66 | private function stopInstances($file) |
|
| 67 | { |
|
| 68 | if (file_exists($file)) { |
|
| 69 | $content = explode(PHP_EOL, file_get_contents($file)); |
|
| 70 | ||
| 71 | if (count($content)) { |
|
| 72 | foreach ($content as $pid) { |
|
| 73 | $pid = (int) trim($pid); |
|
| 74 | ||
| 75 | posix_kill($pid, 9); |
|
| 76 | } |
|
| 77 | } |
|
| 78 | exec('rm '.$file); |
|
| 79 | } |
|
| 80 | } |
|
| 81 | } |
|
| 82 | ||
| @@ 212-224 (lines=13) @@ | ||
| 209 | * |
|
| 210 | * @author Donii Sergii <[email protected]> |
|
| 211 | */ |
|
| 212 | protected function addPidToLog($pid, $fileName = 'server.pids') |
|
| 213 | { |
|
| 214 | $fileName = storage_path($fileName); |
|
| 215 | if (!file_exists(storage_path($fileName))) { |
|
| 216 | file_put_contents($fileName, $pid); |
|
| 217 | ||
| 218 | return; |
|
| 219 | } |
|
| 220 | ||
| 221 | $content = file_get_contents($fileName); |
|
| 222 | ||
| 223 | file_put_contents($fileName, $content.PHP_EOL.$pid); |
|
| 224 | } |
|
| 225 | } |
|
| 226 | ||