function drush_sitealias_get_record

8.0.x drush_sitealias_get_record($alias, $alias_context = NULL)
6.x drush_sitealias_get_record($alias, $alias_context = NULL)
7.x drush_sitealias_get_record($alias, $alias_context = NULL)
3.x drush_sitealias_get_record($alias)
4.x drush_sitealias_get_record($alias)
5.x drush_sitealias_get_record($alias, $alias_context = NULL)
master drush_sitealias_get_record($alias, $alias_context = NULL)

Get a site alias record given an alias name or site specification.

If it is the name of a site alias, return the alias record from the site aliases array.

If it is the name of a folder in the 'sites' folder, construct an alias record from values stored in settings.php.

If it is a site specification, construct an alias record from the values in the specification.

Site specifications come in several forms:

1.) /path/to/drupal#sitename 2.) user@server/path/to/drupal#sitename 3.) user@server/path/to/drupal (sitename == server) 4.) user@server#sitename (only if $option['r'] set in some drushrc file on server) 5.) #sitename (only if $option['r'] already set, and 'sitename' is a folder in $option['r']/sites) 6.) sitename (only if $option['r'] already set, and 'sitename' is a folder in $option['r']/sites)

Note that in the case of the first four forms, it is also possible to add additional site variable to the specification using uri query syntax. For example:



alias: An alias name or site specification

Return value

array An alias record, or empty if none found.

12 calls to drush_sitealias_get_record()
drush_sitealias_evaluate_path in includes/
Evaluate a path from its shorthand form to a literal path usable by rsync.
drush_sitealias_is_bootstrapped_site in includes/
Check to see if we have already bootstrapped to a site.
drush_sitealias_resolve_sitelist in includes/
Given an alias record that is a site list (contains a 'site-list' entry), resolve all of the members of the site list and return them is an array of alias records.
drush_sitealias_resolve_sitespecs in includes/
Given an array of site specifications, resolve each one in turn and return an array of alias records. If you only want a single record, it is preferable to simply call drush_sitealias_get_record directly.
drush_upgrade_site_upgrade in commands/core/
A drush command callback.

... See full list


includes/, line 89
The site alias API.


function drush_sitealias_get_record($alias) {
  // Check to see if the alias contains commas.  If it does, then
  // we will go ahead and make a site list record
  $alias_record = array();
  if (strpos($alias, ',') !== false) {
    // TODO:  If the site list contains any site lists, or site
    // search paths, then we should expand those and merge them
    // into this list longhand.
    $alias_record['site-list'] = explode(',', $alias);
  else {
    $alias_record = _drush_sitealias_get_record($alias);
  if (!empty($alias_record)) {
    if (!array_key_exists('name', $alias_record)) {
      $alias_record['name'] = drush_sitealias_uri_to_site_dir($alias);

    // Handle nested alias definitions and command-specific options.
  return $alias_record;