Vhost templates: Extended the cron scripts to check for the designated webserver and referential integrity

This commit is contained in:
Johannes Feichtner
2016-02-27 20:19:50 +01:00
parent 088eef9728
commit 101e791add
3 changed files with 46 additions and 37 deletions

View File

@@ -868,9 +868,11 @@ class apache extends HttpConfigBase {
// check if vhost config template is set and if so, merge it
if ($domain['vhostsettingid'] != 0) {
$vhostsettings_stmt = Database::prepare("SELECT `description`, `vhostsettings` FROM " . TABLE_PANEL_VHOSTCONFIGS . " WHERE `id` = :id LIMIT 1;");
$vhostsettings_stmt = Database::prepare("SELECT `description`, `vhostsettings` FROM " . TABLE_PANEL_VHOSTCONFIGS . "
WHERE `webserver` = 'apache2' AND `id` = :id LIMIT 1;");
$vhostconfig = Database::pexecute_first($vhostsettings_stmt, array('id' => $domain['vhostsettingid']));
if (is_array($vhostconfig)) {
$vhost_content .= $this->processSpecialConfigTemplate(
$vhostconfig['vhostsettings'],
$domain,
@@ -878,6 +880,7 @@ class apache extends HttpConfigBase {
$domain['port'],
$ssl_vhost) . "\n";
}
}
if ($domain['specialsettings'] != '') {
$vhost_content .= $this->processSpecialConfigTemplate(

View File

@@ -457,9 +457,11 @@ class lighttpd extends HttpConfigBase {
// check if vhost config template is set and if so, merge it
if ($domain['vhostsettingid'] != 0) {
$vhostsettings_stmt = Database::prepare("SELECT `description`, `vhostsettings` FROM " . TABLE_PANEL_VHOSTCONFIGS . " WHERE `id` = :id LIMIT 1;");
$vhostsettings_stmt = Database::prepare("SELECT `description`, `vhostsettings` FROM " . TABLE_PANEL_VHOSTCONFIGS . "
WHERE `webserver` = 'lighttpd' AND `id` = :id LIMIT 1;");
$vhostconfig = Database::pexecute_first($vhostsettings_stmt, array('id' => $domain['vhostsettingid']));
if (is_array($vhostconfig)) {
$vhost_content .= $this->processSpecialConfigTemplate(
$vhostconfig['vhostsettings'],
$domain,
@@ -467,6 +469,7 @@ class lighttpd extends HttpConfigBase {
$domain['port'],
$ssl_vhost) . "\n";
}
}
if ($domain['specialsettings'] != "") {
$vhost_content.= $this->processSpecialConfigTemplate(

View File

@@ -446,9 +446,11 @@ class nginx extends HttpConfigBase {
// check if vhost config template is set and if so, merge it
if ($domain['vhostsettingid'] != 0) {
$vhostsettings_stmt = Database::prepare("SELECT `description`, `vhostsettings` FROM " . TABLE_PANEL_VHOSTCONFIGS . " WHERE `id` = :id LIMIT 1;");
$vhostsettings_stmt = Database::prepare("SELECT `description`, `vhostsettings` FROM " . TABLE_PANEL_VHOSTCONFIGS . "
WHERE `webserver` = 'nginx' AND `id` = :id LIMIT 1;");
$vhostconfig = Database::pexecute_first($vhostsettings_stmt, array('id' => $domain['vhostsettingid']));
if (is_array($vhostconfig)) {
// replace {SOCKET} var with unix socket
$php = new phpinterface($domain);
$vhostconfig['vhostsettings'] = str_replace("{SOCKET}", $php->getInterface()->getSocketFile(), $vhostconfig['vhostsettings']);
@@ -461,6 +463,7 @@ class nginx extends HttpConfigBase {
$ssl_vhost
));
}
}
if ($domain['specialsettings'] != "") {
$vhost_content = $this->mergeVhostCustom($vhost_content, $this->processSpecialConfigTemplate(