function drupal_static_reset
Same name in other branches
- 7.x includes/bootstrap.inc \drupal_static_reset()
- 8.9.x core/includes/bootstrap.inc \drupal_static_reset()
- 10 core/includes/bootstrap.inc \drupal_static_reset()
- 11.x core/includes/bootstrap.inc \drupal_static_reset()
Resets one or all centrally stored static variable(s).
Parameters
$name: Name of the static variable to reset. Omit to reset all variables. Resetting all variables should only be used, for example, for running unit tests with a clean environment.
25 calls to drupal_static_reset()
- BookManagerDeprecationTest::testDrupalStaticResetDeprecation in core/
modules/ book/ tests/ src/ Kernel/ BookManagerDeprecationTest.php - @dataProvider providerTestDrupalStaticResetDeprecation
- drupal_flush_all_caches in core/
includes/ common.inc - Rebuilds the container, flushes all persistent caches, resets all variables, and rebuilds all data structures.
- FilterAPITest::testDependencyRemoval in core/
modules/ filter/ tests/ src/ Kernel/ FilterAPITest.php - Tests that filter format dependency removal works.
- filter_formats_reset in core/
modules/ filter/ filter.module - Resets the text format caches.
- FunctionalTestSetupTrait::prepareEnvironment in core/
lib/ Drupal/ Core/ Test/ FunctionalTestSetupTrait.php - Prepares the current environment for running the test.
1 string reference to 'drupal_static_reset'
- KernelTestBase::tearDown in core/
tests/ Drupal/ KernelTests/ KernelTestBase.php
File
-
core/
includes/ bootstrap.inc, line 662
Code
function drupal_static_reset($name = NULL) {
switch ($name) {
case 'taxonomy_vocabulary_get_names':
@trigger_error("Calling drupal_static_reset() with 'taxonomy_vocabulary_get_names' as argument is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. There is no replacement for this usage. See https://www.drupal.org/node/3039041", E_USER_DEPRECATED);
break;
case 'node_mark':
@trigger_error("Calling drupal_static_reset() with 'node_mark' as argument is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. There is no replacement for this usage. See https://www.drupal.org/node/3037203", E_USER_DEPRECATED);
break;
case 'Drupal\\book\\BookManager::bookSubtreeData':
case 'Drupal\\book\\BookManager::bookTreeAllData':
case 'Drupal\\book\\BookManager::doBookTreeBuild':
@trigger_error("Calling drupal_static_reset() with '{$name}' as argument is deprecated in drupal:9.3.0 and is removed in drupal:10.0.0. Use \\Drupal::service('book.memory_cache')->deleteAll() instead. See https://www.drupal.org/node/3039439", E_USER_DEPRECATED);
\Drupal::service('book.memory_cache')->deleteAll();
break;
}
drupal_static($name, NULL, TRUE);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.