1 | <?php |
||
16 | class LiteSpeedProxy extends AbstractProxy |
||
17 | { |
||
18 | protected $binary = '/usr/local/lsws/bin/lswsctrl'; |
||
19 | |||
20 | protected $port = 8080; |
||
21 | |||
22 | protected $cacheDir = '/usr/local/lsws/cachedata'; |
||
23 | |||
24 | /** |
||
25 | * {@inheritdoc} |
||
26 | */ |
||
27 | public function start() |
||
28 | { |
||
29 | $process = $this->runCommand([ |
||
30 | $this->getBinary(), |
||
31 | 'status', |
||
32 | ], true); |
||
33 | |||
34 | // Already running, restart |
||
35 | if (false !== strpos($process->getOutput(), 'litespeed is running with PID')) { |
||
36 | $this->runCommand([ |
||
37 | $this->getBinary(), |
||
38 | 'restart', |
||
39 | ], true); |
||
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(), 2000); |
||
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 |