Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Database.php

function Database::setActiveConnection

Sets the active connection to the specified key.

Return value

string|null The previous database connection key.

5 calls to Database::setActiveConnection()
DbImportCommand::runScript in core/lib/Drupal/Core/Command/DbImportCommand.php
Run the database script.
Tasks::connect in core/lib/Drupal/Core/Database/Install/Tasks.php
Checks if we can connect to the database.
Tasks::connect in core/modules/pgsql/src/Driver/Database/pgsql/Install/Tasks.php
Checks if we can connect to the database.
Tasks::connect in core/modules/sqlite/src/Driver/Database/sqlite/Install/Tasks.php
Checks if we can connect to the database.
Tasks::connect in core/modules/mysql/src/Driver/Database/mysql/Install/Tasks.php
Checks if we can connect to the database.

File

core/lib/Drupal/Core/Database/Database.php, line 173

Class

Database
Primary front-controller for the database system.

Namespace

Drupal\Core\Database

Code

public static final function setActiveConnection($key = 'default') {
    if (!empty(self::$databaseInfo[$key])) {
        $old_key = self::$activeKey;
        self::$activeKey = $key;
        return $old_key;
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal