Commit c7cb8ec9 authored by anarcat's avatar anarcat Committed by Antoine Beaupre

make alias deletion silent when we use redirection

parent 5de538fb
......@@ -21,7 +21,9 @@ function drush_provision_drupal_pre_provision_delete($url, $backup_file = NULL)
*/
function drush_provision_drupal_provision_delete($url) {
_provision_recursive_delete(drush_get_option('sites_path') . "/$url");
_provision_drupal_delete_aliases(drush_get_option('aliases', array()));
// we remove the aliases even if redirection is enabled as a precaution
// if redirection is enabled, keep silent about errors
_provision_drupal_delete_aliases(drush_get_option('aliases', array()), drush_get_option('redirection'));
drush_set_option('installed', FALSE, 'site');
}
......
......@@ -68,7 +68,9 @@ function drush_provision_drupal_provision_migrate($url, $platform) {
*/
function drush_provision_drupal_post_provision_migrate($url) {
drush_set_option('installed', FALSE);
_provision_drupal_delete_aliases(drush_get_option('aliases', array()));
// we remove the aliases even if redirection is enabled as a precaution
// if redirection is enabled, keep silent about errors
_provision_drupal_delete_aliases(drush_get_option('aliases', array()), drush_get_option('redirection'));
_provision_recursive_delete(drush_get_option('sites_path') ."/$url");
}
......
......@@ -371,7 +371,7 @@ function _provision_drupal_maintain_aliases($url) {
if (PROVISION_CONTEXT_SITE) {
// First we delete all the old aliases
drush_set_option('aliases', drush_get_option('aliases'), 'site');
_provision_drupal_delete_aliases(drush_get_option('aliases', array(), 'site'));
_provision_drupal_delete_aliases(drush_get_option('aliases', array(), 'site'), false);
if (!drush_get_option('redirection')) {
$aliases = drush_get_option('aliases');
......@@ -392,15 +392,19 @@ function _provision_drupal_maintain_aliases($url) {
/**
* Delete a list of aliases
*/
function _provision_drupal_delete_aliases($aliases) {
function _provision_drupal_delete_aliases($aliases, $silent = false) {
if (!is_array($aliases)) {
$aliases = explode(",", $aliases);
}
if ($silent) {
$error = NULL;
} else {
$error = dt("Could not remove symlink for alias @alias", array("@alias" => $alias));
}
foreach ($aliases as $alias) {
if ($alias = trim($alias)) {
provision_path("unlink", drush_get_option('docroot_path') . "/sites/" . $alias, TRUE,
dt("Removed symlink for alias @alias", array("@alias" => $alias)),
dt("Could not remove symlink for alias @alias", array("@alias" => $alias)));
dt("Removed symlink for alias @alias", array("@alias" => $alias)), $error);
}
}
}
......
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