|
@ -98,6 +98,27 @@ class NginxVhostHelper |
|
|
return $result; |
|
|
return $result; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* |
|
|
|
|
|
* @return |
|
|
|
|
|
*/ |
|
|
|
|
|
private function getRedirect($path, $domain) |
|
|
|
|
|
{ |
|
|
|
|
|
// getting .conf-file
|
|
|
|
|
|
$content = file_get_contents($path); |
|
|
|
|
|
|
|
|
|
|
|
// result
|
|
|
|
|
|
$result = false; |
|
|
|
|
|
|
|
|
|
|
|
preg_match('/server_name www.'.$domain.'/', $content, $matches); |
|
|
|
|
|
|
|
|
|
|
|
if (count($matches) > 0) { |
|
|
|
|
|
$result = true; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return $result; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* get vhost |
|
|
* get vhost |
|
|
* |
|
|
* |
|
@ -113,10 +134,14 @@ class NginxVhostHelper |
|
|
// getting certificates from a configuration
|
|
|
// getting certificates from a configuration
|
|
|
$certificate = $this->getCertificate($path); |
|
|
$certificate = $this->getCertificate($path); |
|
|
|
|
|
|
|
|
|
|
|
// domain
|
|
|
|
|
|
$domain = str_replace('.conf', '', $filename); |
|
|
|
|
|
|
|
|
$result = array_merge([ |
|
|
$result = array_merge([ |
|
|
'domain' => str_replace('.conf', '', $filename), |
|
|
|
|
|
|
|
|
'domain' => $domain, |
|
|
'path' => $path, |
|
|
'path' => $path, |
|
|
'file' => $filename, |
|
|
'file' => $filename, |
|
|
|
|
|
'redirect_www' => $this->getRedirect($path, $domain) |
|
|
'enabled' => in_array($filename, $enabled), |
|
|
'enabled' => in_array($filename, $enabled), |
|
|
], $certificate); |
|
|
], $certificate); |
|
|
|
|
|
|
|
|