Tasks::connect

protected Tasks::connect()

Check if we can connect to the database.

File

core/lib/Drupal/Core/Database/Install/Tasks.php, line 156

Class

Tasks
Database installer structure.

Namespace

Drupal\Core\Database\Install

Code

protected function connect() {
  try {
    // This doesn't actually test the connection.
    db_set_active();
    // Now actually do a check.
    Database::getConnection();
    $this->pass('Drupal can CONNECT to the database ok.');
  }
  catch (\Exception $e) {
    $this->fail(t('Failed to connect to your database server. The server reports the following message: %error.<ul><li>Is the database server running?</li><li>Does the database exist, and have you entered the correct database name?</li><li>Have you entered the correct username and password?</li><li>Have you entered the correct database hostname?</li></ul>', array('%error' => $e->getMessage())));
    return FALSE;
  }
  return TRUE;
}
doc_Drupal
2016-10-29 09:46:21
Comments
Leave a Comment

Please login to continue.