function Database::ignoreTarget

Same name in other branches
  1. 9 core/lib/Drupal/Core/Database/Database.php \Drupal\Core\Database\Database::ignoreTarget()
  2. 8.9.x core/lib/Drupal/Core/Database/Database.php \Drupal\Core\Database\Database::ignoreTarget()
  3. 10 core/lib/Drupal/Core/Database/Database.php \Drupal\Core\Database\Database::ignoreTarget()
  4. 11.x 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 slave 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

$key: The database connection key.

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

2 calls to Database::ignoreTarget()
DatabaseConnectionTestCase::testConnectionRoutingOverride in modules/simpletest/tests/database_test.test
Test that connections return appropriate connection objects.
system_init in modules/system/system.module
Implements hook_init().

File

includes/database/database.inc, line 1857

Class

Database
Primary front-controller for the database system.

Code

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

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