add nginx and lighttpd support, refactor into common base class

This commit is contained in:
Chris Vigelius
2015-07-06 14:15:01 +02:00
parent d9e0854bb7
commit de84419035
4 changed files with 100 additions and 44 deletions

View File

@@ -0,0 +1,38 @@
<?php
/***
* Class HttpConfigBase
*
* Base class for all HTTP server configs
*
*/
class HttpConfigBase {
/**
* process special config as template, by substituting {VARIABLE} with the
* respective value.
*
* The following variables are known at the moment:
*
* {DOMAIN} - domain name
* {IP} - IP for this domain
* {PORT} - Port for this domain
* {CUSTOMER} - customer name
* {IS_SSL} - '1' if domain/ip is ssl, '' otherwise
* {DOCROOT} - document root for this domain
*
* @param $template
* @return string
*/
protected function processSpecialConfigTemplate($template, $ipandport, $domain) {
$templateVars = array(
'DOMAIN' => $domain['domain'],
'CUSTOMER' => $domain['loginname'],
'IP' => $ipandport['ip'],
'PORT' => $ipandport['port'],
'IS_SSL' => $domain['ssl'],
'DOCROOT' => $domain['documentroot']
);
return replace_variables($template, $templateVars);
}
}