function drush_valid_db_credentials

8.0.x environment.inc drush_valid_db_credentials()
6.x environment.inc drush_valid_db_credentials()
7.x environment.inc drush_valid_db_credentials()
3.x environment.inc drush_valid_db_credentials()
4.x environment.inc drush_valid_db_credentials()
5.x environment.inc drush_valid_db_credentials()
master environment.inc drush_valid_db_credentials()

Tests the currently loaded database credentials to ensure a database connection can be made.

1 call to drush_valid_db_credentials()

File

includes/environment.inc, line 368
Functions used by drush to query the environment and setting the current configuration.

Code

function drush_valid_db_credentials() {
  try {
    $sql = drush_sql_get_class();
    if (!$sqlVersion = drush_sql_get_version()) {
      return FALSE;
    }
    if (!$sqlVersion->valid_credentials($sql->db_spec())) {
      return FALSE;
    }
    return $sql->query('SELECT 1;');
  }
  catch (Exception $e) {
    return FALSE;
  }
}