function drush_sitealias_add_db_settings

8.0.x drush_sitealias_add_db_settings(&$alias_record)
6.x drush_sitealias_add_db_settings(&$alias_record)
7.x drush_sitealias_add_db_settings(&$alias_record)
3.x drush_sitealias_add_db_settings(&$alias_record)
4.x drush_sitealias_add_db_settings(&$alias_record)
5.x drush_sitealias_add_db_settings(&$alias_record)
master drush_sitealias_add_db_settings(&$alias_record)

If the alias record does not contain a 'databases' or 'db-url' entry, then use backend invoke to look up the settings value from the remote or local site. The 'databases' form is preferred; 'db_url' will be converted to 'databases' if necessary.


$alias_record: The full alias record to populate with database settings

2 calls to drush_sitealias_add_db_settings()
sitealias_get_databases_from_record in includes/
Return the databases record from the alias record
_drush_sitealias_print_record in commands/core/
Given a site alias name, print out a php-syntax representation of it.


includes/, line 578
The site alias API.


function drush_sitealias_add_db_settings(&$alias_record) {
  $altered_record = FALSE;

  // If the alias record does not have a defined 'databases' entry,
  // then we'll need to look one up
  if (!isset($alias_record['db-url']) && !isset($alias_record['databases']) && !isset($alias_record['site-list'])) {
    $values = drush_do_site_command($alias_record, "sql-conf", array(), array('all' => TRUE));
    if (isset($values['object'])) {
      $alias_record['databases'] = $values['object'];
      $altered_record = TRUE;
      // If the name is set, then re-cache the record after we fetch the databases
      if (array_key_exists('name', $alias_record)) {
        $all_site_aliases = &drush_get_context('site-aliases');
        $all_site_aliases[$alias_record['name']] = $alias_record;

  return $altered_record;