function _drush_sitealias_find_and_load_alias

8.0.x _drush_sitealias_find_and_load_alias($aliasname, $alias_path_context = NULL)
6.x _drush_sitealias_find_and_load_alias($aliasname, $alias_path_context = NULL)
7.x _drush_sitealias_find_and_load_alias($aliasname, $alias_path_context = NULL)
3.x _drush_sitealias_find_and_load_alias($aliasname, $alias_path_context = NULL)
4.x _drush_sitealias_find_and_load_alias($aliasname, $alias_path_context = NULL)
5.x _drush_sitealias_find_and_load_alias($aliasname, $alias_path_context = NULL)
master _drush_sitealias_find_and_load_alias($aliasname, $alias_path_context = NULL)

Traverses the alias search path and finds the specified alias record.


$aliasname: The name of the alias without the leading '@' (i.e. '#name') or NULL to load every alias found in every alias file.

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

Return value

An empty array if nothing was loaded. If $aliasname is not null, then the array returned is the alias record for $aliasname. If $aliasname is NULL, then the array returned is a $kay => $value pair of alias names and alias records loaded.

1 call to _drush_sitealias_find_and_load_alias()
_drush_sitealias_load_alias in includes/
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.


includes/, line 660
The site alias API.


function _drush_sitealias_find_and_load_alias($aliasname, $alias_path_context = NULL) {
  // Special checking for '@sites' alias
  if ($aliasname == 'sites') {
    $drupal_root = NULL;
    if ($alias_path_context != null) {
      if (array_key_exists('root', $alias_path_context) && !array_key_exists('remote-host', $alias_path_context)) {
        $drupal_root = $alias_path_context['root'];
    else {
      $drupal_root = \Drush::bootstrapManager()->getRoot();
    if (isset($drupal_root) && !is_array($drupal_root)) {

  $alias_files_to_consider = _drush_sitealias_find_alias_files($aliasname, $alias_path_context);

  return _drush_sitealias_find_and_load_alias_from_file($aliasname, $alias_files_to_consider);