Commit 11a43ae5 authored by Adrian Rossouw's avatar Adrian Rossouw Committed by adrian

Fix up the alias handling some more, such as deleting the old aliases on...

Fix up the alias handling some more, such as deleting the old aliases on delete and migrate. Also fixed the email routines to point to the right file now that the conditional includes are in their own directory
parent 2b9c1c96
......@@ -18,13 +18,8 @@ function provision_drupal_pre_provision_delete($url, $backup_file) {
* This can't be rolled back. so won't even try.
*/
function provision_drupal_provision_delete($url) {
$old_aliases = drush_get_option('aliases', array(), 'site');
if (sizeof($old_aliases) == sizeof(drush_get_option('aliases'))) {
_provision_drupal_delete_aliases($old_aliases);
}
_provision_recursive_delete(drush_get_option('sites_path') . "/$url");
_provision_drupal_delete_aliases(drush_get_option('aliases', array()));
drush_set_option('installed', FALSE, 'site');
}
......
......@@ -77,6 +77,10 @@ function provision_drupal_pre_provision_deploy_rollback($url) {
}
}
function provision_drupal_provision_deploy($url) {
_provision_drupal_maintain_aliases($url);
}
function provision_drupal_post_provision_deploy($url) {
_provision_drupal_create_settings_file($url);
......
......@@ -69,12 +69,12 @@ function install_send_welcome_mail($url, $profile, $language, $client_email) {
require_once "./profiles/$profile/provision_welcome_mail.inc";
$mailkey = 'welcome-mail-admin';
}
elseif (file_exists(dirname(__FILE__) . '/provision_welcome_mail.inc')) {
elseif (file_exists(dirname(__FILE__) . '/../provision_welcome_mail.inc')) {
/** use the module provided welcome email
* We can not use drupal_get_path here,
* as we are connected to the provisioned site's database
*/
require_once dirname(__FILE__) . '/provision_welcome_mail.inc';
require_once dirname(__FILE__) . '/../provision_welcome_mail.inc';
$mailkey = 'welcome-mail-admin';
}
else {
......
......@@ -86,12 +86,12 @@ function install_mail($key, &$message, $params) {
require_once "./profiles/$profile/provision_welcome_mail.inc";
$custom = TRUE;
}
elseif (file_exists(dirname(__FILE__) . '/provision_welcome_mail.inc')) {
elseif (file_exists(dirname(__FILE__) . '/../provision_welcome_mail.inc')) {
/** use the module provided welcome email
* We can not use drupal_get_path here,
* as we are connected to the provisioned site's database
*/
require_once dirname(__FILE__) . '/provision_welcome_mail.inc';
require_once dirname(__FILE__) . '/../provision_welcome_mail.inc';
$custom = TRUE;
}
else {
......
......@@ -93,12 +93,12 @@ function install_mail($key, &$message, $params) {
require_once "./profiles/$profile/provision_welcome_mail.inc";
$custom = TRUE;
}
elseif (file_exists(dirname(__FILE__) . '/provision_welcome_mail.inc')) {
elseif (file_exists(dirname(__FILE__) . '/../provision_welcome_mail.inc')) {
/** use the module provided welcome email
* We can not use drupal_get_path here,
* as we are connected to the provisioned site's database
*/
require_once dirname(__FILE__) . '/provision_welcome_mail.inc';
require_once dirname(__FILE__) . '/../provision_welcome_mail.inc';
$custom = TRUE;
}
else {
......
......@@ -54,6 +54,7 @@ function provision_drupal_provision_migrate($url, $platform) {
*/
function provision_drupal_post_provision_migrate($url) {
drush_set_option('installed', FALSE);
_provision_drupal_delete_aliases(drush_get_option('aliases', array()));
_provision_recursive_delete(drush_get_option('sites_path') ."/$url");
}
......
......@@ -351,16 +351,8 @@ function _provision_drupal_get_cvs_versions($files) {
*/
function _provision_drupal_maintain_aliases($url) {
if (PROVISION_CONTEXT_SITE) {
$old_aliases = drush_get_option('aliases', array(), 'site');
if (!is_array($old_aliases)) {
$old_aliases = explode(",", $old_aliases);
}
/**
* First we remove all the old aliases
*/
_provision_drupal_delete_aliases($old_aliases);
// First we delete all the old aliases
_provision_drupal_delete_aliases(drush_get_option('aliases', array(), 'site'));
$aliases = explode("," , drush_get_option('aliases'));
if (!is_array($aliases)) {
......@@ -380,6 +372,9 @@ function _provision_drupal_maintain_aliases($url) {
* Delete a list of aliases
*/
function _provision_drupal_delete_aliases($aliases) {
if (!is_array($aliases)) {
$aliases = explode(",", $aliases);
}
foreach ($aliases as $alias) {
if (trim($alias)) {
provision_path("unlink", drush_get_option('docroot_path') . "/sites/" . $alias, TRUE,
......
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