You are here

public static function Database::ignoreTarget in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Database/Database.php \Drupal\Core\Database\Database::ignoreTarget()

Instructs the system to temporarily ignore a given key/target.

At times we need to temporarily disable replica queries. To do so, call this method with the database key and the target to disable. That database key will then always fall back to 'default' for that key, even if it's defined.

Parameters

string $key: The database connection key.

string $target: The target of the specified key to ignore.

2 calls to Database::ignoreTarget()
ConnectionTest::testConnectionRoutingOverride in core/modules/system/src/Tests/Database/ConnectionTest.php
Tests that connections return appropriate connection objects.
ReplicaDatabaseIgnoreSubscriber::checkReplicaServer in core/lib/Drupal/Core/EventSubscriber/ReplicaDatabaseIgnoreSubscriber.php
Checks and disables the replica database server if appropriate.

File

core/lib/Drupal/Core/Database/Database.php, line 443
Contains \Drupal\Core\Database\Database.

Class

Database
Primary front-controller for the database system.

Namespace

Drupal\Core\Database

Code

public static function ignoreTarget($key, $target) {
  self::$ignoreTargets[$key][$target] = TRUE;
}