function _drush_sitealias_set_context_by_name

8.0.x _drush_sitealias_set_context_by_name($alias, $prefix = '')
6.x _drush_sitealias_set_context_by_name($alias, $prefix = '')
7.x _drush_sitealias_set_context_by_name($alias, $prefix = '')
3.x _drush_sitealias_set_context_by_name($alias, $prefix = '')
4.x _drush_sitealias_set_context_by_name($alias, $prefix = '')
5.x _drush_sitealias_set_context_by_name($alias, $prefix = '')
master _drush_sitealias_set_context_by_name($alias, $prefix = '')

Looks up the specified alias record and calls through to drush_sitealias_set_alias_context, below.


alias: The name of the alias record

prefix: The prefix value to afix to the beginning of every key set.

Return value

boolean TRUE is an alias was found and processed.

4 calls to _drush_sitealias_set_context_by_name()
drush_preflight in includes/
During the initialization of Drush, this is the first step where we load our configuration and commandfiles, and select the site we are going to operate on; however, we take no irreversible actions (e.g. site bootstrapping). This allows commands that…
drush_sitealias_check_arg in includes/
Check to see if the first command-line arg or the -l option is a site alias; if it is, copy its record values to the 'alias' context.
drush_sitealias_check_site_env in includes/
drush_sitealias_site_set in commands/core/
Set the DRUPAL_SITE variable by writing it out to a temporary file that we then source for persistent site switching.


includes/, line 1705
The site alias API.


function _drush_sitealias_set_context_by_name($alias, $prefix = '') {
  if ($alias) {
    $site_alias_settings = drush_sitealias_get_record($alias);
    if (!empty($site_alias_settings)) {
      drush_sitealias_set_alias_context($site_alias_settings, $prefix);
      if (empty($prefix)) {
        // Create an alias '@self'
        _drush_sitealias_cache_alias('@self', $site_alias_settings);
        // change the selected site to match the new --root and --uri, if any were set
      return $site_alias_settings;
  return array();