Commit 0c83306e authored by anarcat's avatar anarcat

fix multiple vhost support for subdir

parent f497cd33
......@@ -8,7 +8,11 @@
*/
class Provision_Config_Apache_SubdirVhost extends Provision_Config_Http {
public $template = 'subdir_vhost.tpl.php';
public $description = 'subdirectory support';
public $description = 'subdirectory vhost support';
// hack: because the parent class doesn't support multiple config
// files, we need to keep track of the alias we're working on.
protected $current_alias;
/**
* Guess the URI this subdir alias is related too.
......@@ -24,6 +28,16 @@ class Provision_Config_Apache_SubdirVhost extends Provision_Config_Http {
return explode('/', $this->current_alias, 2)[1];
}
function write() {
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();
}
}
}
function process() {
parent::process();
$this->data['uri'] = $this->uri();
......@@ -32,6 +46,7 @@ class Provision_Config_Apache_SubdirVhost extends Provision_Config_Http {
}
function filename() {
// XXX: this will OVERWRITE existing vhosts!
return $this->data['http_vhostd_path'] . '/' . $this->uri();
}
}
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