Commit f4e40989 authored by omega8cc's avatar omega8cc

Fix the warnings and scary errors on site migrate (subdir).

Undefined offset: 1 Subdir.php:46
Undefined offset: 1 Subdir.php:46
Undefined variable: parent_site SubdirVhost.php:61
unlink(/var/aegir/config/server_master/nginx/vhost.d/): Is a directory FileSystem.php:122
Undefined variable: parent_site SubdirVhost.php:61
parent 7acac7bf
......@@ -30,14 +30,23 @@ class Provision_Config_Apache_SubdirVhost extends Provision_Config_Http {
return $e[1];
}
/**
* Check if the parent (domain) site (vhost) exists.
*/
function parent_site() {
$vhost_parent_site = $this->data['http_vhostd_path'] . '/' . $this->uri();
if (provision_file()->exists($vhost_parent_site)->status()) {
$e = TRUE;
}
return $e;
}
function write() {
$parent_site = FALSE;
foreach (d()->aliases as $alias) {
if (strpos($alias, '/')) {
$this->current_alias = $alias;
$if_parent_site = $this->data['http_vhostd_path'] . '/' . $this->uri();
if (provision_file()->exists($if_parent_site)->status()) {
$parent_site = TRUE;
if ($this->parent_site()) {
$site_parent = TRUE;
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');
......@@ -58,7 +67,7 @@ class Provision_Config_Apache_SubdirVhost extends Provision_Config_Http {
}
function filename() {
if (!$parent_site) {
if (!$site_parent) {
return $this->data['http_vhostd_path'] . '/' . $this->uri();
}
}
......
......@@ -30,14 +30,23 @@ class Provision_Config_Nginx_SubdirVhost extends Provision_Config_Http {
return $e[1];
}
/**
* Check if the parent (domain) site (vhost) exists.
*/
function parent_site() {
$vhost_parent_site = $this->data['http_vhostd_path'] . '/' . $this->uri();
if (provision_file()->exists($vhost_parent_site)->status()) {
$e = TRUE;
}
return $e;
}
function write() {
$parent_site = FALSE;
foreach (d()->aliases as $alias) {
if (strpos($alias, '/')) {
$this->current_alias = $alias;
$if_parent_site = $this->data['http_vhostd_path'] . '/' . $this->uri();
if (provision_file()->exists($if_parent_site)->status()) {
$parent_site = TRUE;
if ($this->parent_site()) {
$site_parent = TRUE;
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');
......@@ -58,7 +67,7 @@ class Provision_Config_Nginx_SubdirVhost extends Provision_Config_Http {
}
function filename() {
if (!$parent_site) {
if (!$site_parent) {
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