@@ 17-51 (lines=35) @@ | ||
14 | /** |
|
15 | * ApacheWebServer is the webserver class for apache httpd webserver. |
|
16 | */ |
|
17 | class ApacheWebServer extends WebServer |
|
18 | { |
|
19 | /** |
|
20 | * Constructor. |
|
21 | * |
|
22 | * @param string $version the semver-like version of the apache webserver |
|
23 | */ |
|
24 | public function __construct($version = '') |
|
25 | { |
|
26 | parent::__construct('apache', $version); |
|
27 | } |
|
28 | ||
29 | public function extractVersion($settings = '') |
|
30 | { |
|
31 | $matches = []; |
|
32 | $regexp = '/^Server version: Apache\/([0-9\.]+) .*/'; |
|
33 | ||
34 | if (preg_match($regexp, $settings, $matches)) { |
|
35 | return $matches[1]; |
|
36 | } |
|
37 | ||
38 | return ''; |
|
39 | } |
|
40 | ||
41 | public function extractRootConfigurationFile($settings = '') |
|
42 | { |
|
43 | $matches = []; |
|
44 | $regexp = '/ -D SERVER_CONFIG_FILE="([^"]+)"/'; |
|
45 | if (preg_match($regexp, $settings, $matches)) { |
|
46 | return $matches[1]; |
|
47 | } |
|
48 | ||
49 | return ''; |
|
50 | } |
|
51 | } |
|
52 |
@@ 17-51 (lines=35) @@ | ||
14 | /** |
|
15 | * NginxWebServer is the webserver class for nginx httpd webserver. |
|
16 | */ |
|
17 | class NginxWebServer extends WebServer |
|
18 | { |
|
19 | /** |
|
20 | * Constructor. |
|
21 | * |
|
22 | * @param string $version the semver-like version of the apache webserver |
|
23 | */ |
|
24 | public function __construct($version = '') |
|
25 | { |
|
26 | parent::__construct('nginx', $version); |
|
27 | } |
|
28 | ||
29 | public function extractVersion($settings = '') |
|
30 | { |
|
31 | $matches = []; |
|
32 | $regexp = '/^nginx version: nginx\/([0-9\.]+).*/'; |
|
33 | ||
34 | if (preg_match($regexp, $settings, $matches)) { |
|
35 | return $matches[1]; |
|
36 | } |
|
37 | ||
38 | return ''; |
|
39 | } |
|
40 | ||
41 | public function extractRootConfigurationFile($settings = '') |
|
42 | { |
|
43 | $matches = []; |
|
44 | $regexp = '/--conf-path=([^\s]+) /'; |
|
45 | if (preg_match($regexp, $settings, $matches)) { |
|
46 | return $matches[1]; |
|
47 | } |
|
48 | ||
49 | return ''; |
|
50 | } |
|
51 | } |
|
52 |