Commit 5e2bb34e authored by omega8cc's avatar omega8cc

Issue #2020089 by ergonlogic - Allow example.com and example.com/foo domains (Apache)

parent 37261284
...@@ -31,13 +31,16 @@ class Provision_Config_Apache_SubdirVhost extends Provision_Config_Http { ...@@ -31,13 +31,16 @@ class Provision_Config_Apache_SubdirVhost extends Provision_Config_Http {
} }
function write() { function write() {
$parent_site = FALSE;
foreach (d()->aliases as $alias) { foreach (d()->aliases as $alias) {
if (strpos($alias, '/')) { if (strpos($alias, '/')) {
$this->current_alias = $alias; $this->current_alias = $alias;
if (d($this->uri())) { $if_parent_site = $this->data['http_vhostd_path'] . '/' . $this->uri();
drush_log(dt('virtual host %vhost already exist for alias %alias, skipping', array('%vhost' => $this->uri(), '%alias' => $alias)), 'warning'); if (provision_file()->exists($if_parent_site)->status()) {
// XXX: we need to verify that vhost here, or at least $parent_site = TRUE;
// generate its configuration file. drush_log(dt('Parent site %vhost already exists for alias %alias, skipping', array('%vhost' => $this->uri(), '%alias' => $alias)), 'notice');
$site_name = '@' . $this->uri();
provision_backend_invoke($site_name, 'provision-verify');
} }
else { else {
drush_log("Subdirectory alias `$alias` found. Creating vhost configuration file.", 'notice'); drush_log("Subdirectory alias `$alias` found. Creating vhost configuration file.", 'notice');
...@@ -55,7 +58,8 @@ class Provision_Config_Apache_SubdirVhost extends Provision_Config_Http { ...@@ -55,7 +58,8 @@ class Provision_Config_Apache_SubdirVhost extends Provision_Config_Http {
} }
function filename() { function filename() {
// XXX: this will OVERWRITE existing vhosts! if (!$parent_site) {
return $this->data['http_vhostd_path'] . '/' . $this->uri(); return $this->data['http_vhostd_path'] . '/' . $this->uri();
}
} }
} }
...@@ -84,6 +84,12 @@ if ($this->redirection || $ssl_redirection) { ...@@ -84,6 +84,12 @@ if ($this->redirection || $ssl_redirection) {
</IfModule> </IfModule>
</Directory> </Directory>
<?php
$if_subsite = $this->data['http_subdird_path'] . '/' . $this->uri;
if (subdirs_drush_load() && provision_file()->exists($if_subsite)->status()) {
print " Include " . $if_subsite . "/*.conf\n";
}
?>
</VirtualHost> </VirtualHost>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment