function drush_sitealias_alias_path

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

Return the array of paths where alias files are searched for.

Parameters

$alias_path_context: If the alias being looked up is part of a relative alias, the alias path context specifies the context of the primary alias the new alias is rooted from. Alias files stored in the sites folder of this context, or inside the context itself takes priority over any other search path that might define a similarly-named alias. In this way, multiple sites can define a '@peer' alias.

Return value

An array of paths

1 call to drush_sitealias_alias_path()
_drush_sitealias_find_and_load_alias in includes/sitealias.inc
Worker function called by _drush_sitealias_load_alias and drush_sitealias_load_all. Traverses the alias search path and finds the specified alias record.

File

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

Code

function drush_sitealias_alias_path($alias_path_context = NULL) {
  if (isset($alias_path_context)) {
    return array(drush_sitealias_local_site_path($alias_path_context));
  }
  else {
    // We get the current list of site paths by adding NULL
    // (nothing) to the path list, which is a no-op
    $site_paths = drush_sitealias_add_to_alias_path(NULL);

    // If the user defined the root of a drupal site, then also
    // look for alias files there.
    $drupal_root = drush_get_context('DRUSH_DRUPAL_ROOT');
    if (empty($drupal_root)) {
      $drupal_root = drush_get_option(array('root', 'r'), NULL);
    }
    if (isset($drupal_root)) {
      $site_paths[] = $drupal_root;
    }
    $alias_path = (array) drush_get_option('alias-path', array());
    if (empty($alias_path)) {
      $alias_path[] = drush_get_context('ETC_PREFIX', '') . '/etc/drush';
      $alias_path[] = dirname(__FILE__) . '/..';
      $alias_path[] = dirname(__FILE__) . '/../aliases';
      if (!is_null(drush_server_home())) {
        $alias_path[] = drush_server_home() . '/.drush';
      }
    }

    return array_unique(array_merge($alias_path, $site_paths));
  }
}