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.

18 calls to drush_sitealias_get_record()
drush_backend_output in includes/
drush_invoke_sitealias_args in includes/
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/
Process the --bootstrap-to-first-arg option, if it is present.
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.

... See full list


includes/, line 108
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;