summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntoine Beaupré2013-09-28 21:30:19 (GMT)
committerAntoine Beaupré2013-09-28 21:30:21 (GMT)
commitd6b35d8aceaebad2097db9b878a18f4c46aa4c29 (patch)
tree97dc912908c6c514c2130ed62114ee18fa7ed438
parent61cc6e25cf951e0fa6b0d6d69fc53748bbe1d79f (diff)
don't overwrite example.com if it existsdev/subdirs
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
-rw-r--r--http/Provision/Config/Apache/SubdirVhost.php11
-rw-r--r--subdirs/subdirs.drush.inc15
2 files changed, 24 insertions, 2 deletions
diff --git a/http/Provision/Config/Apache/SubdirVhost.php b/http/Provision/Config/Apache/SubdirVhost.php
index bb7fe71..0420a1f 100644
--- a/http/Provision/Config/Apache/SubdirVhost.php
+++ b/http/Provision/Config/Apache/SubdirVhost.php
@@ -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();
+ }
}
}
}
diff --git a/subdirs/subdirs.drush.inc b/subdirs/subdirs.drush.inc
index 02d1178..ee321ab 100644
--- a/subdirs/subdirs.drush.inc
+++ b/subdirs/subdirs.drush.inc
@@ -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";
+ }
+}