Commit d6b35d8a authored by anarcat's avatar anarcat

don't overwrite example.com if it exists

instead we hook into it using the hook_provision_apache_vhost_config()

unfotunately, this will not work right away - the site will need to be
verified.

also, if the subdir site is deleted, the apache config will be
corrupt, we would need to generate (and not verify, because then it's
too late) example.com then too.

finally, that glob() is highly suspicious, and none of this is tested
- i suspect http_subdird_path is not populated here

this is all to fix #2020089
parent 61cc6e25
......@@ -32,8 +32,15 @@ class Provision_Config_Apache_SubdirVhost extends Provision_Config_Http {
foreach (d()->aliases as $alias) {
if (strpos($alias, '/')) {
$this->current_alias = $alias;
drush_log("Subdirectory alias `$alias` found. Creating vhost configuration file.", 'notice');
parent::write();
if (d($this->uri())) {
drush_log(dt('virtual host %vhost already exist for alias %alias, skipping', array('%vhost' => $this->uri(), '%alias' => $alias)), 'warning');
// XXX: we need to verify that vhost here, or at least
// generate its configuration file.
}
else {
drush_log("Subdirectory alias `$alias` found. Creating vhost configuration file.", 'notice');
parent::write();
}
}
}
}
......
......@@ -117,3 +117,18 @@ function _subdirs_remove_symlinks() {
}
}
}
/**
* Inject our includes into existing virtual host
*
* Implementation of hook_provision_apache_vhost_config().
*
* This is the case where example.com exists for the alias example.com/foo.
*/
function subdirs_provision_apache_vhost_config($uri, $data) {
$subdirs_path = $data['http_subdird_path'] . '/' . $uri . '/*.conf'; // wild guess
if (glob($subdirs_path)) {
return "# subdirectory sites for this virtual host
Include $subdirs_path";
}
}
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