You are here

public function ExtensionList::reset in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Extension/ExtensionList.php \Drupal\Core\Extension\ExtensionList::reset()
  2. 9 core/lib/Drupal/Core/Extension/ExtensionList.php \Drupal\Core\Extension\ExtensionList::reset()

Resets the stored extension list.

We don't reset statically added filenames, as it is a static cache which logically can't change. This is done for performance reasons of the installer.

Return value

$this

1 method overrides ExtensionList::reset()
ThemeExtensionList::reset in core/lib/Drupal/Core/Extension/ThemeExtensionList.php
Resets the stored extension list.

File

core/lib/Drupal/Core/Extension/ExtensionList.php, line 163

Class

ExtensionList
Provides available extensions.

Namespace

Drupal\Core\Extension

Code

public function reset() {
  $this->extensions = NULL;
  $this->cache
    ->delete($this
    ->getListCacheId());
  $this->extensionInfo = NULL;
  $this->cache
    ->delete($this
    ->getInfoCacheId());
  $this->pathNames = NULL;
  try {
    $this->state
      ->delete($this
      ->getPathnamesCacheId());
  } catch (DatabaseExceptionWrapper $e) {

    // Ignore exceptions caused by a non existing {key_value} table in the
    // early installer.
  }
  $this->cache
    ->delete($this
    ->getPathnamesCacheId());

  // @todo In the long run it would be great to add the reset, but the early
  //   installer fails due to that. https://www.drupal.org/node/2719315 could
  //   help to resolve with that.
  return $this;
}