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,15 +868,18 @@ class apache extends HttpConfigBase {
// check if vhost config template is set and if so, merge it // check if vhost config template is set and if so, merge it
if ($domain['vhostsettingid'] != 0) { 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'])); $vhostconfig = Database::pexecute_first($vhostsettings_stmt, array('id' => $domain['vhostsettingid']));
$vhost_content .= $this->processSpecialConfigTemplate( if (is_array($vhostconfig)) {
$vhostconfig['vhostsettings'], $vhost_content .= $this->processSpecialConfigTemplate(
$domain, $vhostconfig['vhostsettings'],
$domain['ip'], $domain,
$domain['port'], $domain['ip'],
$ssl_vhost) . "\n"; $domain['port'],
$ssl_vhost) . "\n";
}
} }
if ($domain['specialsettings'] != '') { if ($domain['specialsettings'] != '') {

View File

@@ -457,15 +457,18 @@ class lighttpd extends HttpConfigBase {
// check if vhost config template is set and if so, merge it // check if vhost config template is set and if so, merge it
if ($domain['vhostsettingid'] != 0) { 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'])); $vhostconfig = Database::pexecute_first($vhostsettings_stmt, array('id' => $domain['vhostsettingid']));
$vhost_content .= $this->processSpecialConfigTemplate( if (is_array($vhostconfig)) {
$vhostconfig['vhostsettings'], $vhost_content .= $this->processSpecialConfigTemplate(
$domain, $vhostconfig['vhostsettings'],
$domain['ip'], $domain,
$domain['port'], $domain['ip'],
$ssl_vhost) . "\n"; $domain['port'],
$ssl_vhost) . "\n";
}
} }
if ($domain['specialsettings'] != "") { if ($domain['specialsettings'] != "") {

View File

@@ -446,20 +446,23 @@ class nginx extends HttpConfigBase {
// check if vhost config template is set and if so, merge it // check if vhost config template is set and if so, merge it
if ($domain['vhostsettingid'] != 0) { 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'])); $vhostconfig = Database::pexecute_first($vhostsettings_stmt, array('id' => $domain['vhostsettingid']));
// replace {SOCKET} var with unix socket if (is_array($vhostconfig)) {
$php = new phpinterface($domain); // replace {SOCKET} var with unix socket
$vhostconfig['vhostsettings'] = str_replace("{SOCKET}", $php->getInterface()->getSocketFile(), $vhostconfig['vhostsettings']); $php = new phpinterface($domain);
$vhostconfig['vhostsettings'] = str_replace("{SOCKET}", $php->getInterface()->getSocketFile(), $vhostconfig['vhostsettings']);
$vhost_content = $this->mergeVhostCustom($vhost_content, $this->processSpecialConfigTemplate( $vhost_content = $this->mergeVhostCustom($vhost_content, $this->processSpecialConfigTemplate(
$vhostconfig['vhostsettings'], $vhostconfig['vhostsettings'],
$domain, $domain,
$domain['ip'], $domain['ip'],
$domain['port'], $domain['port'],
$ssl_vhost $ssl_vhost
)); ));
}
} }
if ($domain['specialsettings'] != "") { if ($domain['specialsettings'] != "") {