function UpdateRegistry::discoverExtensions

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Update/UpdateRegistry.php \Drupal\Core\Update\UpdateRegistry::discoverExtensions()

Discovers all module, theme, and profile extensions.

Return value

\Drupal\Core\Extension\Extension[] The discovered extensions, keyed by name.

File

core/lib/Drupal/Core/Update/UpdateRegistry.php, line 252

Class

UpdateRegistry
Provides all and missing update implementations.

Namespace

Drupal\Core\Update

Code

protected function discoverExtensions() : array {
  $cache_id = 'update_registry.extensions';
  if ($cache = $this->memoryCache
    ->get($cache_id)) {
    $extensions = $cache->data;
  }
  else {
    $extension_discovery = new ExtensionDiscovery($this->root, TRUE, [], $this->sitePath);
    $module_extensions = $extension_discovery->scan('module');
    $theme_extensions = $this->includeThemes() ? $extension_discovery->scan('theme') : [];
    $profile_extensions = $extension_discovery->scan('profile');
    $extensions = array_merge($module_extensions, $theme_extensions, $profile_extensions);
    $this->memoryCache
      ->set($cache_id, $extensions, tags: [
      'config:core.extension',
    ]);
  }
  return $extensions;
}

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