function drush_sitealias_build_record_from_settings_file

8.0.x sitealias.inc drush_sitealias_build_record_from_settings_file($site_settings_file, $alias = null, $drupal_root = null)
6.x sitealias.inc drush_sitealias_build_record_from_settings_file($site_settings_file, $alias = null, $drupal_root = null)
7.x sitealias.inc drush_sitealias_build_record_from_settings_file($site_settings_file, $alias = null, $drupal_root = null)
3.x sitealias.inc drush_sitealias_build_record_from_settings_file($site_settings_file, $alias = null, $drupal_root = null)
4.x sitealias.inc drush_sitealias_build_record_from_settings_file($site_settings_file, $alias = null, $drupal_root = null)
5.x sitealias.inc drush_sitealias_build_record_from_settings_file($site_settings_file, $alias = null, $drupal_root = null)
master sitealias.inc drush_sitealias_build_record_from_settings_file($site_settings_file, $alias = null, $drupal_root = null)
2 calls to drush_sitealias_build_record_from_settings_file()
_drush_sitealias_find_record_for_local_site in includes/sitealias.inc
If '$alias' is the name of a folder in the sites folder of the given drupal root, then build an alias record for it
_drush_sitealias_site_list in commands/core/sitealias.drush.inc
Return a list of all of the local sites at the current drupal root.

File

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

Code

function drush_sitealias_build_record_from_settings_file($site_settings_file, $alias = null, $drupal_root = null) {
  $alias_record = array();

  if (file_exists($site_settings_file)) {
    if (!isset($drupal_root)) {
      $drupal_root = drush_locate_root($site_settings_file);
    }

    $alias_record['root'] = $drupal_root;
    if (isset($alias)) {
      $alias_record['uri'] = $alias;
    }
    else {
      $alias_record['uri'] = _drush_sitealias_site_dir_to_uri(drush_sitealias_site_dir_from_filename($site_settings_file));
    }
  }

  return $alias_record;
}