public function Sql7::get_db_spec

8.0.x Sql7.php public Sql7::get_db_spec()
7.x Sql7.php public Sql7::get_db_spec()
master Sql7.php public Sql7::get_db_spec()

Overrides SqlVersion::get_db_spec

1 method overrides Sql7::get_db_spec()
Sql8::get_db_spec in lib/Drush/Sql/Sql8.php

File

lib/Drush/Sql/Sql7.php, line 6

Namespace

Drush\Sql

Class

Sql7

Code

public function get_db_spec() {
  $db_spec = NULL;
  drush_sql_bootstrap_database_configuration();
  $database = drush_get_option('database', 'default');
  $target = drush_get_option('target', 'default');
  // We don't use DB API here `sql-sync` would have to messily addConnection.
  if (!isset($GLOBALS['databases']) || !array_key_exists($database, $GLOBALS['databases']) || !array_key_exists($target, $GLOBALS['databases'][$database])) {
    // Do nothing
  }
  else {
    $db_spec = $GLOBALS['databases'][$database][$target];
  }
  return $db_spec;
}