You are here

protected function UpdateRegistry::scanExtensionsAndLoadUpdateFiles in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Update/UpdateRegistry.php \Drupal\Core\Update\UpdateRegistry::scanExtensionsAndLoadUpdateFiles()
  2. 9 core/lib/Drupal/Core/Update/UpdateRegistry.php \Drupal\Core\Update\UpdateRegistry::scanExtensionsAndLoadUpdateFiles()

Scans all module, theme, and profile extensions and load the update files.

Parameters

string|null $extension: (optional) Limits the extension update files loaded to the provided extension.

File

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

Class

UpdateRegistry
Provides all and missing update implementations.

Namespace

Drupal\Core\Update

Code

protected function scanExtensionsAndLoadUpdateFiles(string $extension = NULL) {

  // Scan for extensions.
  $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);

  // Limit to a single extension.
  if ($extension) {
    $extensions = array_intersect_key($extensions, [
      $extension => TRUE,
    ]);
  }
  $this
    ->loadUpdateFiles($extensions);
}