- added possibility to set a custom docroot for any ip/port combination, fixes #417

- sort vhosts-file by type (subdomain, sub-of-main, main-domain), fixes #437
This commit is contained in:
Michael Kaufmann (d00p)
2010-10-15 10:41:58 +00:00
parent ceedab3a6e
commit db05ea5f32
10 changed files with 97 additions and 15 deletions

View File

@@ -189,17 +189,26 @@ class apache
{
$this->virtualhosts_data[$vhosts_filename].= '<VirtualHost ' . $ipport . '>' . "\n";
/**
* add 'real'-vhost content here, like doc-root :)
*/
if($this->settings['system']['froxlordirectlyviahostname'])
if($row_ipsandports['docroot'] == '')
{
$mypath = makeCorrectDir(dirname(dirname(dirname(__FILE__))));
/**
* add 'real'-vhost content here, like doc-root :)
*/
if($this->settings['system']['froxlordirectlyviahostname'])
{
$mypath = makeCorrectDir(dirname(dirname(dirname(__FILE__))));
}
else
{
$mypath = makeCorrectDir(dirname(dirname(dirname(dirname(__FILE__)))));
}
}
else
else
{
$mypath = makeCorrectDir(dirname(dirname(dirname(dirname(__FILE__)))));
// user-defined docroot, #417
$mypath = makeCorrectDir($row_ipsandports['docroot']);
}
$this->virtualhosts_data[$vhosts_filename].= 'DocumentRoot "'.$mypath.'"'."\n";
if($row_ipsandports['vhostcontainer_servername_statement'] == '1')
@@ -1111,6 +1120,13 @@ class apache
// Save one big file
$vhosts_file = '';
// sort by filename so the order is:
// 1. subdomains 20
// 2. subdomains as main-domains 21
// 3. main-domains 22
// #437
ksort($this->virtualhosts_data);
foreach($this->virtualhosts_data as $vhosts_filename => $vhost_content)
{
$vhosts_file.= $vhost_content . "\n\n";

View File

@@ -107,14 +107,23 @@ class lighttpd
$this->lighttpd_data[$vhost_filename].= '# Froxlor default vhost' . "\n";
$this->lighttpd_data[$vhost_filename].= '$HTTP["host"] =~ "^(?:www\.|)' . $myhost . '$" {' . "\n";
if($this->settings['system']['froxlordirectlyviahostname'])
if($row_ipsandports['docroot'] == '')
{
$mypath = makeCorrectDir(dirname(dirname(dirname(__FILE__))));
if($this->settings['system']['froxlordirectlyviahostname'])
{
$mypath = makeCorrectDir(dirname(dirname(dirname(__FILE__))));
}
else
{
$mypath = makeCorrectDir(dirname(dirname(dirname(dirname(__FILE__)))));
}
}
else
else
{
$mypath = makeCorrectDir(dirname(dirname(dirname(dirname(__FILE__)))));
// user-defined docroot, #417
$mypath = makeCorrectDir($row_ipsandports['docroot']);
}
$this->lighttpd_data[$vhost_filename].= ' server.document-root = "'.$mypath.'"'."\n";
/**
@@ -855,6 +864,13 @@ class lighttpd
// Save one big file
$vhosts_file = '';
// sort by filename so the order is:
// 1. subdomains
// 2. subdomains as main-domains
// 3. main-domains
// #437
ksort($this->lighttpd_data);
foreach($this->lighttpd_data as $vhosts_filename => $vhost_content)
{
$vhosts_file.= $vhost_content . "\n\n";