function UpdateRegistry::scanExtensionsAndLoadUpdateFiles

Same name in other branches
  1. 9 core/lib/Drupal/Core/Update/UpdateRegistry.php \Drupal\Core\Update\UpdateRegistry::scanExtensionsAndLoadUpdateFiles()
  2. 8.9.x core/lib/Drupal/Core/Update/UpdateRegistry.php \Drupal\Core\Update\UpdateRegistry::scanExtensionsAndLoadUpdateFiles()
  3. 11.x 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.

3 calls to UpdateRegistry::scanExtensionsAndLoadUpdateFiles()
UpdateRegistry::getPendingUpdateFunctions in core/lib/Drupal/Core/Update/UpdateRegistry.php
Find all update functions that haven't been executed.
UpdateRegistry::getRemovedPostUpdates in core/lib/Drupal/Core/Update/UpdateRegistry.php
Gets removed hook_post_update_NAME() implementations for an extension.
UpdateRegistry::getUpdateFunctions in core/lib/Drupal/Core/Update/UpdateRegistry.php
Returns all available updates for a given extension.

File

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

Class

UpdateRegistry
Provides all and missing update implementations.

Namespace

Drupal\Core\Update

Code

protected function scanExtensionsAndLoadUpdateFiles(?string $extension = NULL) {
    if ($extension !== NULL && isset(self::$loadedFiles[$this->root][$this->sitePath][$extension][$this->updateType])) {
        // We've already checked for this file and, if it exists, loaded it.
        return;
    }
    // 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);
}

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