function Database::removeConnection

Same name in other branches
  1. 9 core/lib/Drupal/Core/Database/Database.php \Drupal\Core\Database\Database::removeConnection()
  2. 8.9.x core/lib/Drupal/Core/Database/Database.php \Drupal\Core\Database\Database::removeConnection()
  3. 10 core/lib/Drupal/Core/Database/Database.php \Drupal\Core\Database\Database::removeConnection()
  4. 11.x core/lib/Drupal/Core/Database/Database.php \Drupal\Core\Database\Database::removeConnection()

Remove a connection and its corresponding connection information.

Parameters

$key: The connection key.

$close: Whether to close the connection.

Return value

TRUE in case of success, FALSE otherwise.

2 calls to Database::removeConnection()
DrupalUnitTestCase::tearDown in modules/simpletest/drupal_web_test_case.php
DrupalWebTestCase::tearDown in modules/simpletest/drupal_web_test_case.php
Delete created files and temporary files directory, delete the tables created by setUp(), and reset the database prefix.

File

includes/database/database.inc, line 1752

Class

Database
Primary front-controller for the database system.

Code

public static final function removeConnection($key, $close = TRUE) {
    if (isset(self::$databaseInfo[$key])) {
        if ($close) {
            self::closeConnection(NULL, $key);
        }
        unset(self::$databaseInfo[$key]);
        return TRUE;
    }
    else {
        return FALSE;
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.