/**
* Scans all module, theme, and profile extensions and load the update files.
*
* @param string|null $extension
* (optional) Limits the extension update files loaded to the provided
* extension.
*/
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);
}