function drush_sitealias_get_record

8.0.x sitealias.inc drush_sitealias_get_record($alias, $alias_context = NULL)
6.x sitealias.inc drush_sitealias_get_record($alias, $alias_context = NULL)
7.x sitealias.inc drush_sitealias_get_record($alias, $alias_context = NULL)
3.x sitealias.inc drush_sitealias_get_record($alias)
4.x sitealias.inc drush_sitealias_get_record($alias)
5.x sitealias.inc drush_sitealias_get_record($alias, $alias_context = NULL)
master sitealias.inc 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:

user@server/path/to/drupal?db-url=...#sitename

Parameters

alias: An alias name or site specification

Return value

array An alias record, or empty if none found.

18 calls to drush_sitealias_get_record()
drush_backend_output in includes/backend.inc
drush_invoke_sitealias_args in includes/command.inc
Invoke a command in a new process, targeting the site specified by the provided site alias record.
drush_process_bootstrap_to_first_arg in includes/command.inc
Process the --bootstrap-to-first-arg option, if it is present.
drush_sitealias_evaluate_path in includes/sitealias.inc
Evaluate a path from its shorthand form to a literal path usable by rsync.
drush_sitealias_is_bootstrapped_site in includes/sitealias.inc
Check to see if we have already bootstrapped to a site.

... See full list

File

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

Code

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.
    drush_set_config_special_contexts($alias_record);
  }
  return $alias_record;
}