diff --git a/platform/drupal/install_7.inc b/platform/drupal/install_7.inc index 6b887a0da9f6676ba87d590ca02757bdb983a784..0e13f06a5900e76aa9712708300c9c9d3d8da23a 100644 --- a/platform/drupal/install_7.inc +++ b/platform/drupal/install_7.inc @@ -82,18 +82,18 @@ function install_main() { drush_bootstrap(DRUSH_BOOTSTRAP_DRUPAL_CONFIGURATION); // We have an existing settings.php. - - // Drush 5. - if (function_exists('_drush_sql_get_db_spec')) { - $db_spec = _drush_sql_get_db_spec(); - } - // Drush 4. - elseif (function_exists('drush_sql_read_db_spec')) { - $db_spec = drush_sql_read_db_spec(); - } - // Drush 3. - else { - $db_spec = drush_core_site_install_db_spec(); + + switch (substr(drush_core_version(), 0, 1)) { + case '7': + $sql = drush_get_class('Drush\Sql\Sql', array(), array(drush_drupal_major_version())); + $db_spec = $sql->get_db_spec(); + break; + case '6': + case '5': + $db_spec = _drush_sql_get_db_spec(); + break; + default: + drush_set_error('DRUSH_UNSUPPORTED_VERSION', dt('Drush !version is not supported')); } $db_spec['db_prefix'] = $GLOBALS['db_prefix'];