public function Sql6::get_db_spec

8.0.x Sql6.php public Sql6::get_db_spec()
7.x Sql6.php public Sql6::get_db_spec()

Overrides SqlVersion::get_db_spec

File

lib/Drush/Sql/Sql6.php, line 8

Namespace

Drush\Sql

Class

Sql6

Code

public function get_db_spec() {
  $db_spec = NULL;
  if ($url = isset($GLOBALS['db_url']) ? $GLOBALS['db_url'] : drush_get_option('db-url', NULL)) {
    $database = drush_get_option('database', 'default');
    $url = is_array($url) ? $url[$database] : $url;
    $db_spec = drush_convert_db_from_db_url($url);
    $db_spec['db_prefix'] = isset($GLOBALS['db_prefix']) ? $GLOBALS['db_prefix'] : drush_get_option('db-prefix', NULL);
    // For uniformity with code designed for Drupal 7/8 db_specs, copy the 'db_prefix' to 'prefix'.
    $db_spec['prefix'] = $db_spec['db_prefix'];
  }
  return $db_spec;
}