function ModuleHandler::resetImplementations

Same name in other branches
  1. 9 core/lib/Drupal/Core/Extension/ModuleHandler.php \Drupal\Core\Extension\ModuleHandler::resetImplementations()
  2. 10 core/lib/Drupal/Core/Extension/ModuleHandler.php \Drupal\Core\Extension\ModuleHandler::resetImplementations()
  3. 11.x core/lib/Drupal/Core/Extension/ModuleHandler.php \Drupal\Core\Extension\ModuleHandler::resetImplementations()

Overrides ModuleHandlerInterface::resetImplementations

2 calls to ModuleHandler::resetImplementations()
ModuleHandler::add in core/lib/Drupal/Core/Extension/ModuleHandler.php
Adds a module or profile to the list of currently active modules.
ModuleHandler::setModuleList in core/lib/Drupal/Core/Extension/ModuleHandler.php
Sets an explicit list of currently active modules.

File

core/lib/Drupal/Core/Extension/ModuleHandler.php, line 345

Class

ModuleHandler
Class that manages modules in a Drupal installation.

Namespace

Drupal\Core\Extension

Code

public function resetImplementations() {
    $this->implementations = NULL;
    $this->hookInfo = NULL;
    $this->alterFunctions = NULL;
    // We maintain a persistent cache of hook implementations in addition to the
    // static cache to avoid looping through every module and every hook on each
    // request. Benchmarks show that the benefit of this caching outweighs the
    // additional database hit even when using the default database caching
    // backend and only a small number of modules are enabled. The cost of the
    // $this->cacheBackend->get() is more or less constant and reduced further
    // when non-database caching backends are used, so there will be more
    // significant gains when a large number of modules are installed or hooks
    // invoked, since this can quickly lead to
    // \Drupal::moduleHandler()->implementsHook() being called several thousand
    // times per request.
    $this->cacheBackend
        ->set('module_implements', []);
    $this->cacheBackend
        ->delete('hook_info');
}

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