function _drush_sitealias_load_alias

8.0.x sitealias.inc _drush_sitealias_load_alias($alias, $alias_path_context = NULL)
6.x sitealias.inc _drush_sitealias_load_alias($alias, $alias_path_context = NULL)
7.x sitealias.inc _drush_sitealias_load_alias($alias, $alias_path_context = NULL)
3.x sitealias.inc _drush_sitealias_load_alias($alias, $alias_path_context = NULL)
4.x sitealias.inc _drush_sitealias_load_alias($alias, $alias_path_context = NULL)
5.x sitealias.inc _drush_sitealias_load_alias($alias, $alias_path_context = NULL)
master sitealias.inc _drush_sitealias_load_alias($alias, $alias_path_context = NULL)

Check and see if an alias definition for $alias is available. If it is, load it into the list of aliases cached in the 'site-aliases' context.

Parameters

$alias: The name of the alias to load in ordinary form ('@name')

$alias_path_context: When looking up a relative alias, the alias path context is the primary alias that we will start our search from.

1 call to _drush_sitealias_load_alias()
_drush_sitealias_get_record in includes/sitealias.inc
This is a continuation of drush_sitealias_get_record, above. It is not intended to be called directly.

File

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

Code

function _drush_sitealias_load_alias($alias, $alias_path_context = NULL) {
  $all_site_aliases = drush_get_context('site-aliases');
  $result = array();

  // Only aliases--those named entities that begin with '@'--can be loaded this way.
  // We also skip any alias that has already been loaded.
  if ((substr($alias, 0, 1) == '@') && !array_key_exists($alias, $all_site_aliases)) {
    $aliasname = substr($alias, 1);
    $result = _drush_sitealias_find_and_load_alias($aliasname, $alias_path_context);
    if (!empty($result)) {
      $alias_options = array('site-aliases' => array($aliasname => $result));
      _drush_sitealias_add_inherited_values($alias_options['site-aliases']);
      drush_set_config_special_contexts($alias_options);
      if (array_key_exists('#file', $result)) {
        drush_log(dt('Loaded alias !alias from file !file', array('!alias' => $alias, '!file' => $result['#file'])));
      }
    }
  }

  return $result;
}