Skip to content
Snippets Groups Projects
Commit fea90e52 authored by catch's avatar catch
Browse files

Issue #3294299 by phma, alexpott, pooja saraah, mikelutz: Regression in...

Issue #3294299 by phma, alexpott, pooja saraah, mikelutz: Regression in functional test performance with a large number of modules
parent 0444b520
No related branches found
No related tags found
No related merge requests found
...@@ -96,7 +96,7 @@ public function __construct($root, $site_path, array $enabled_extensions, KeyVal ...@@ -96,7 +96,7 @@ public function __construct($root, $site_path, array $enabled_extensions, KeyVal
* A list of post-update functions that have been removed. * A list of post-update functions that have been removed.
*/ */
public function getRemovedPostUpdates($extension) { public function getRemovedPostUpdates($extension) {
$this->scanExtensionsAndLoadUpdateFiles(); $this->scanExtensionsAndLoadUpdateFiles($extension);
$function = "{$extension}_removed_post_updates"; $function = "{$extension}_removed_post_updates";
if (function_exists($function)) { if (function_exists($function)) {
return $function(); return $function();
...@@ -246,7 +246,7 @@ public function registerInvokedUpdates(array $function_names) { ...@@ -246,7 +246,7 @@ public function registerInvokedUpdates(array $function_names) {
* A list of update functions. * A list of update functions.
*/ */
public function getUpdateFunctions($extension_name) { public function getUpdateFunctions($extension_name) {
$this->scanExtensionsAndLoadUpdateFiles(); $this->scanExtensionsAndLoadUpdateFiles($extension_name);
$all_functions = $this->getAvailableUpdateFunctions(); $all_functions = $this->getAvailableUpdateFunctions();
return array_filter($all_functions, function ($function_name) use ($extension_name) { return array_filter($all_functions, function ($function_name) use ($extension_name) {
...@@ -257,15 +257,24 @@ public function getUpdateFunctions($extension_name) { ...@@ -257,15 +257,24 @@ public function getUpdateFunctions($extension_name) {
/** /**
* Scans all module, theme, and profile extensions and load the update files. * 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() { protected function scanExtensionsAndLoadUpdateFiles(string $extension = NULL) {
// Scan for extensions. // Scan for extensions.
$extension_discovery = new ExtensionDiscovery($this->root, FALSE, [], $this->sitePath); $extension_discovery = new ExtensionDiscovery($this->root, TRUE, [], $this->sitePath);
$module_extensions = $extension_discovery->scan('module'); $module_extensions = $extension_discovery->scan('module');
$theme_extensions = $this->includeThemes() ? $extension_discovery->scan('theme') : []; $theme_extensions = $this->includeThemes() ? $extension_discovery->scan('theme') : [];
$profile_extensions = $extension_discovery->scan('profile'); $profile_extensions = $extension_discovery->scan('profile');
$extensions = array_merge($module_extensions, $theme_extensions, $profile_extensions); $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); $this->loadUpdateFiles($extensions);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment