| 1 | <?php |
||
| 14 | class LiteSpeedProxy extends AbstractProxy |
||
| 15 | { |
||
| 16 | protected $binary = '/usr/local/lsws/bin/lswsctrl'; |
||
| 17 | |||
| 18 | protected $port = 8080; |
||
| 19 | |||
| 20 | protected $cacheDir = '/usr/local/lsws/cachedata'; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * {@inheritdoc} |
||
| 24 | */ |
||
| 25 | public function start() |
||
| 26 | { |
||
| 27 | $process = $this->runCommand([ |
||
| 28 | $this->getBinary(), |
||
| 29 | 'status', |
||
| 30 | ], true); |
||
| 31 | |||
| 32 | // Already running, restart |
||
| 33 | if (false !== strpos($process->getOutput(), 'litespeed is running with PID')) { |
||
| 34 | $this->runCommand([ |
||
| 35 | $this->getBinary(), |
||
| 36 | 'restart', |
||
| 37 | ], true); |
||
| 38 | |||
| 39 | $this->waitFor($this->getIp(), $this->getPort(), 5000); |
||
| 40 | |||
| 41 | return; |
||
| 42 | } |
||
| 43 | |||
| 44 | // Otherwise start |
||
| 45 | $this->runCommand([ |
||
| 46 | $this->getBinary(), |
||
| 47 | 'start', |
||
| 48 | ], true); |
||
| 49 | |||
| 50 | $this->waitFor($this->getIp(), $this->getPort(), 5000); |
||
| 51 | } |
||
| 52 | |||
| 53 | /** |
||
| 54 | * {@inheritdoc} |
||
| 55 | */ |
||
| 56 | public function stop() |
||
| 63 | |||
| 64 | /** |
||
| 65 | * {@inheritdoc} |
||
| 66 | */ |
||
| 67 | public function clear() |
||
| 85 | |||
| 86 | /** |
||
| 87 | * @param string $cacheDir |
||
| 88 | */ |
||
| 89 | public function setCacheDir($cacheDir) |
||
| 93 | |||
| 94 | /** |
||
| 95 | * @return string |
||
| 96 | */ |
||
| 97 | public function getCacheDir() |
||
| 101 | } |
||
| 102 |