function _drush_sitealias_set_context_by_name

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

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

Parameters

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/preflight.inc
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/sitealias.inc
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/sitealias.inc
drush_sitealias_site_set in commands/core/sitealias.drush.inc
Set the DRUPAL_SITE variable by writing it out to a temporary file that we then source for persistent site switching.

File

includes/sitealias.inc, line 1705
The site alias API.

Code

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);
      drush_sitealias_cache_alias_by_path($site_alias_settings);
      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
        _drush_preflight_root_uri();
      }
      return $site_alias_settings;
    }
  }
  return array();
}