function drush_sql_conf

8.0.x sql.drush.inc drush_sql_conf()
6.x sql.drush.inc drush_sql_conf()
7.x sql.drush.inc drush_sql_conf()
3.x sql.drush.inc drush_sql_conf()
4.x sql.drush.inc drush_sql_conf()
5.x sql.drush.inc drush_sql_conf()
master sql.drush.inc drush_sql_conf()

Command callback. Displays the Drupal site's database connection string.

File

commands/sql/sql.drush.inc, line 182
Drush sql commands

Code

function drush_sql_conf() {
  if (drush_get_option('db-url', FALSE)) {
    $db_spec['db-url'] = $GLOBALS['db_url'];
  }
  elseif (drush_get_option('all', FALSE)) {
    $db_spec = _drush_sql_get_all_db_specs();
  }
  if (!isset($db_spec)) {
    $db_spec = _drush_sql_get_db_spec();
  }
  drush_backend_set_result($db_spec);
  if (!drush_get_option('show-passwords', FALSE)) {
    drush_unset_recursive($db_spec, 'password');
  }
  drush_print_r($db_spec);
}