Per an offline discussion with Adrian, Moshe and Anarcat, aliases will be renamed to require an '@' at the head. They will still be defined as $aliases['aliasname'] = array(...);, per #727058: Site aliases should not be cached in the options context, but they will be references as @aliasname.

This will prevent ambiguities should someone choose to name an alias in a way that conflicts with a drush command name or command alias. e.g. drush @dl dl modulename.

Patch coming shortly, after #727058 is committed.

CommentFileSizeAuthor
#1 drush-733244-with-727058.patch23.96 KBgreg.1.anderson
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

greg.1.anderson’s picture

Here is a patch that combines this change with #727058: Site aliases should not be cached in the options context. The key part of this new patch is in the function drush_set_config_options:

  // Change the keys of the site aliases from 'alias' to '@alias'
  if (array_key_exists('site-aliases', $options)) {
    $user_aliases = $options['site-aliases'];
    $options['site-aliases'] = array();
    foreach ($user_aliases as $alias_name => $alias_value) {
      $options['site-aliases']["@$alias_name"] = $alias_value;
    }
  }

We also take the '@' out again when printing with drush site-alias aliasname --full in _drush_sitealias_print_record:

  // Alias names contain an '@' when referenced, but do
  // not contain an '@' when defined.
  if (substr($alias_name,0,1) == '@') {
    $alias_name = substr($alias_name,1);
  }

Everything else works as it did before.

greg.1.anderson’s picture

Status: Active » Needs review
adrian’s picture

Status: Needs review » Closed (duplicate)

This has been rolled into :
#733256: Aliases should be loaded from a central location rather than drushrc.php

This part of the patch specifically seems to be working 100% fine.