diff --git a/core/lib/Drupal/Core/Extension/ExtensionList.php b/core/lib/Drupal/Core/Extension/ExtensionList.php index 050aa54..3c4108c 100644 --- a/core/lib/Drupal/Core/Extension/ExtensionList.php +++ b/core/lib/Drupal/Core/Extension/ExtensionList.php @@ -309,7 +309,7 @@ protected function doListExtensions() { * If there is no extension with the supplied name. */ public function getExtensionInfo($extension_name) { - $all_info = $this->getAllInstalledInfo(); + $all_info = $this->getAllAvailableInfo(); if (isset($all_info[$extension_name])) { return $all_info[$extension_name]; } @@ -392,14 +392,14 @@ public function getFilenames() { if ($cache = $this->cache->get($cache_id)) { $file_names = $cache->data; } - // We use $file_names below. + // Check first if filenames are already stored in state. elseif ($file_names = $this->state->get($cache_id)) { } else { $file_names = $this->recalculateFilenames(); - // Store filenames to allow static::getFilename() to retrieve them - // without having to rebuild or scan the filesystem. - $this->state->set($cache, $file_names); + // Store filenames in cache and in state to allow static::getFilename() + // to retrieve them without having to rebuild or scan the filesystem. + $this->state->set($cache_id, $file_names); $this->cache->set($cache_id, $file_names); } $this->fileNames = $file_names; diff --git a/core/lib/Drupal/Core/Extension/ModuleExtensionList.php b/core/lib/Drupal/Core/Extension/ModuleExtensionList.php index 20c4cfa..fd8c5b1 100644 --- a/core/lib/Drupal/Core/Extension/ModuleExtensionList.php +++ b/core/lib/Drupal/Core/Extension/ModuleExtensionList.php @@ -101,44 +101,7 @@ protected function getActiveProfile() { /** * {@inheritdoc} */ - protected function doScanExtensions() { - $extensions = parent::doScanExtensions(); - - $profile_extension_discovery = new ExtensionDiscovery($this->root); - $profiles = $profile_extension_discovery->scan('profile'); - // Modify the active profile object that was previously added to the module - // list. - $active_profile_name = drupal_get_profile(); - if ($active_profile_name && isset($profiles[$active_profile_name])) { - $extensions[$active_profile_name] = $active_profile = $profiles[$active_profile_name]; - $active_profile = $extensions[$active_profile_name]; - // Installation profiles are hidden by default, unless explicitly - // specified otherwise in the .info.yml file. - if (!isset($active_profile->info['hidden'])) { - $active_profile->info['hidden'] = TRUE; - } - - // The installation profile is required, if it's a valid module. - $active_profile->info['required'] = TRUE; - // Add a default distribution name if the profile did not provide one. - // @see install_profile_info() - // @see drupal_install_profile_distribution_name() - if (!isset($active_profile->info['distribution']['name'])) { - $active_profile->info['distribution']['name'] = 'Drupal'; - } - - // Installation profile hooks are always executed last. - $active_profile->weight = 1000; - } - - return $extensions; - } - - /** - * {@inheritdoc} - */ protected function doListExtensions() { - // Find modules. $extensions = parent::doListExtensions(); // It is possible that a module was marked as required by @@ -154,6 +117,12 @@ protected function doListExtensions() { $module->status = (int) isset($installed_modules[$name]); $module->schema_version = SCHEMA_UNINSTALLED; } + + // Add the active profile to the module list. + if ($active_profile = $this->getActiveProfile()) { + $extensions[$active_profile->getName()] = $active_profile; + } + $extensions = $this->moduleHandler->buildModuleDependencies($extensions); return $extensions; diff --git a/core/lib/Drupal/Core/Extension/ProfileExtensionList.php b/core/lib/Drupal/Core/Extension/ProfileExtensionList.php index 7c3ecb3..544c10f 100644 --- a/core/lib/Drupal/Core/Extension/ProfileExtensionList.php +++ b/core/lib/Drupal/Core/Extension/ProfileExtensionList.php @@ -21,6 +21,39 @@ class ProfileExtensionList extends ExtensionList { /** * {@inheritdoc} */ + protected function doListExtensions() { + $profiles = parent::doListExtensions(); + + // Ensure required information is available on the active profile object. + $active_profile_name = drupal_get_profile(); + if ($active_profile_name && isset($profiles[$active_profile_name])) { + // Installation profiles are hidden by default, unless explicitly + // specified otherwise in the .info.yml file. + if (!isset($profiles[$active_profile_name]->info['hidden'])) { + $profiles[$active_profile_name]->info['hidden'] = TRUE; + } + + // The active profile is required. + $profiles[$active_profile_name]->info['required'] = TRUE; + // Add a default distribution name if the profile did not provide one. + // @see install_profile_info() + // @see drupal_install_profile_distribution_name() + if (!isset($profiles[$active_profile_name]->info['distribution']['name'])) { + $profiles[$active_profile_name]->info['distribution']['name'] = 'Drupal'; + } + + // Installation profile hooks are always executed last. + $profiles[$active_profile_name]->weight = 1000; + // The active installation profile is installed. + $profiles[$active_profile_name]->status = 1; + } + + return $profiles; + } + + /** + * {@inheritdoc} + */ protected function getInstalledExtensionsNames() { return [drupal_get_profile()]; }