solve sub-sub-domain-problem by dynamically assigning vhost-number in vhost-filename (the deeper the lower the number thus being included earlier), fixes #1535

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2015-07-28 15:11:55 +02:00
parent 8332b77fcc
commit 222841f09b
3 changed files with 15 additions and 12 deletions

View File

@@ -610,14 +610,15 @@ class apache {
&& ((int)$domain['ismainbutsubto'] == 0 && ((int)$domain['ismainbutsubto'] == 0
|| domainMainToSubExists($domain['ismainbutsubto']) == false) || domainMainToSubExists($domain['ismainbutsubto']) == false)
) { ) {
$vhost_no = '22'; $vhost_no = '35';
} elseif ((int)$domain['parentdomainid'] == 0 } elseif ((int)$domain['parentdomainid'] == 0
&& isCustomerStdSubdomain((int)$domain['id']) == false && isCustomerStdSubdomain((int)$domain['id']) == false
&& (int)$domain['ismainbutsubto'] > 0 && (int)$domain['ismainbutsubto'] > 0
) { ) {
$vhost_no = '21'; $vhost_no = '30';
} else { } else {
$vhost_no = '20'; // number of dots in a domain specifies it's position (and depth of subdomain) starting at 29 going downwards on higher depth
$vhost_no = (string)(30 - substr_count($domain['domain'], ".") + 1);
} }
if ($ssl_vhost === true) { if ($ssl_vhost === true) {
@@ -1118,9 +1119,9 @@ class apache {
$vhosts_file = ''; $vhosts_file = '';
// sort by filename so the order is: // sort by filename so the order is:
// 1. subdomains 20 // 1. subdomains x-29
// 2. subdomains as main-domains 21 // 2. subdomains as main-domains 30
// 3. main-domains 22 // 3. main-domains 35
// #437 // #437
ksort($this->virtualhosts_data); ksort($this->virtualhosts_data);

View File

@@ -299,7 +299,7 @@ class lighttpd {
$_pos = strrpos($_tmp_path, '/'); $_pos = strrpos($_tmp_path, '/');
$_inc_path = substr($_tmp_path, $_pos+1); $_inc_path = substr($_tmp_path, $_pos+1);
// subdomain // maindomain
if ((int)$domain['parentdomainid'] == 0 if ((int)$domain['parentdomainid'] == 0
&& isCustomerStdSubdomain((int)$domain['id']) == false && isCustomerStdSubdomain((int)$domain['id']) == false
&& ((int)$domain['ismainbutsubto'] == 0 && ((int)$domain['ismainbutsubto'] == 0
@@ -314,9 +314,10 @@ class lighttpd {
) { ) {
$vhost_no = '51'; $vhost_no = '51';
} }
// main domain // subdomains
else { else {
$vhost_no = '52'; // number of dots in a domain specifies it's position (and depth of subdomain) starting at 89 going downwards on higher depth
$vhost_no = (string)(90 - substr_count($domain['domain'], ".") + 1);
} }
if ($ssl == '1') { if ($ssl == '1') {

View File

@@ -289,14 +289,15 @@ class nginx {
&& ((int)$domain['ismainbutsubto'] == 0 && ((int)$domain['ismainbutsubto'] == 0
|| domainMainToSubExists($domain['ismainbutsubto']) == false) || domainMainToSubExists($domain['ismainbutsubto']) == false)
) { ) {
$vhost_no = '22'; $vhost_no = '35';
} elseif ((int)$domain['parentdomainid'] == 0 } elseif ((int)$domain['parentdomainid'] == 0
&& isCustomerStdSubdomain((int)$domain['id']) == false && isCustomerStdSubdomain((int)$domain['id']) == false
&& (int)$domain['ismainbutsubto'] > 0 && (int)$domain['ismainbutsubto'] > 0
) { ) {
$vhost_no = '21'; $vhost_no = '30';
} else { } else {
$vhost_no = '20'; // number of dots in a domain specifies it's position (and depth of subdomain) starting at 29 going downwards on higher depth
$vhost_no = (string)(30 - substr_count($domain['domain'], ".") + 1);
} }
if ($ssl_vhost === true) { if ($ssl_vhost === true) {