diff -u b/core/lib/Drupal/Core/Extension/ExtensionDiscovery.php b/core/lib/Drupal/Core/Extension/ExtensionDiscovery.php --- b/core/lib/Drupal/Core/Extension/ExtensionDiscovery.php +++ b/core/lib/Drupal/Core/Extension/ExtensionDiscovery.php @@ -249,8 +249,13 @@ // In case both profile directories contain the same extension, the actual // profile always has precedence. if ($profile) { - $profile_handler = \Drupal::service('profile_handler'); - $this->profileDirectories = array_merge($profile_handler->getProfileDirectories($profile), $this->profileDirectories); + if (\Drupal::hasService('profile_handler')) { + $profile_handler = \Drupal::service('profile_handler'); + $this->profileDirectories = array_merge($profile_handler->getProfileDirectories($profile), $this->profileDirectories); + } + else { + $this->profileDirectories[] = drupal_get_path('profile', $profile); + } } return $this; only in patch2: unchanged: --- a/core/lib/Drupal/Core/Config/ExtensionInstallStorage.php +++ b/core/lib/Drupal/Core/Config/ExtensionInstallStorage.php @@ -86,13 +86,13 @@ protected function getAllFolders() { $modules = $extensions['module']; // Remove the install profile as this is handled later. unset($modules[$install_profile]); - $profile_list = $listing->scan('profile'); - if ($profile && isset($profile_list[$profile])) { + $profiles = $listing->scan('profile'); + foreach ($profiles as $profile_name => $profile_object) { // Prime the drupal_get_filename() static cache with the profile info // file location so we can use drupal_get_path() on the active profile // during the module scan. // @todo Remove as part of https://www.drupal.org/node/2186491 - drupal_get_filename('profile', $profile, $profile_list[$profile]->getPathname()); + drupal_get_filename('profile', $profile_name, $profile_object->getPathname()); } $module_list_scan = $listing->scan('module'); $module_list = array(); @@ -121,9 +121,12 @@ protected function getAllFolders() { if (!isset($profile_list)) { $profile_list = $listing->scan('profile'); } - if (isset($profile_list[$profile])) { - $profile_folders = $this->getComponentNames(array($profile_list[$profile])); - $this->folders = $profile_folders + $this->folders; + $profile_names = \Drupal::service('profile_handler')->getProfileDependencies($profile); + foreach ($profile_names as $profile_name) { + if (isset($profile_list[$profile_name])) { + $profile_folders = $this->getComponentNames(array($profile_list[$profile_name])); + $this->folders = $profile_folders + $this->folders; + } } } } only in patch2: unchanged: --- a/core/lib/Drupal/Core/Config/InstallStorage.php +++ b/core/lib/Drupal/Core/Config/InstallStorage.php @@ -155,16 +155,18 @@ protected function getAllFolders() { // yet because the system module may not yet be enabled during install. // @todo Remove as part of https://www.drupal.org/node/2186491 $listing = new ExtensionDiscovery(\Drupal::root()); - if ($profile = drupal_get_profile()) { - $profile_list = $listing->scan('profile'); - if (isset($profile_list[$profile])) { - // Prime the drupal_get_filename() static cache with the profile info - // file location so we can use drupal_get_path() on the active profile - // during the module scan. - // @todo Remove as part of https://www.drupal.org/node/2186491 - drupal_get_filename('profile', $profile, $profile_list[$profile]->getPathname()); - $this->folders += $this->getComponentNames(array($profile_list[$profile])); - } + $profiles = $listing->scan('profile'); + foreach ($profiles as $profile_name => $profile_object) { + // Prime the drupal_get_filename() static cache with the profile info + // file location so we can use drupal_get_path() on the active profile + // during the module scan. + // @todo Remove as part of https://www.drupal.org/node/2186491 + drupal_get_filename('profile', $profile_name, $profile_object->getPathname()); + } + // Now that we can fetch the path, get dependent profiles and add the extensions + $profile_names = \Drupal::service('profile_handler')->getProfileDependencies(drupal_get_profile()); + foreach ($profile_names as $profile_name) { + $this->folders += $this->getComponentNames(array($profiles[$profile_name])); } // @todo Remove as part of https://www.drupal.org/node/2186491 $this->folders += $this->getComponentNames($listing->scan('module')); only in patch2: unchanged: --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -963,22 +963,31 @@ function _system_rebuild_module_data() { // module scan as the module scan requires knowing what the active profile is. // @todo Remove as part of https://www.drupal.org/node/2186491. $profiles = $listing->scan('profile'); - $profile = drupal_get_profile(); - if ($profile && isset($profiles[$profile])) { + foreach ($profiles as $profile_name => $profile) { // Prime the drupal_get_filename() static cache with the profile info file // location so we can use drupal_get_path() on the active profile during // the module scan. // @todo Remove as part of https://www.drupal.org/node/2186491. - drupal_get_filename('profile', $profile, $profiles[$profile]->getPathname()); + drupal_get_filename('profile', $profile_name, $profile->getPathname()); } // Find modules. $modules = $listing->scan('module'); - // Include the installation profile in modules that are loaded. + + $profile = drupal_get_profile(); if ($profile) { - $modules[$profile] = $profiles[$profile]; + $profile_names = \Drupal::service('profile_handler')->getProfileDependencies($profile); + } + else { + $profile_names = array_keys($profiles); + } + // Include the installation profile in modules that are loaded. + $weight = 1000; + foreach ($profile_names as $profile_name) { + $modules[$profile_name] = $profiles[$profile_name]; // Installation profile hooks are always executed last. - $modules[$profile]->weight = 1000; + $modules[$profile_name]->weight = $weight; + $weight++; } // Set defaults for module info. @@ -1004,7 +1013,7 @@ function _system_rebuild_module_data() { // Installation profiles are hidden by default, unless explicitly specified // otherwise in the .info.yml file. - if ($key == $profile && !isset($modules[$key]->info['hidden'])) { + if (in_array($key, $profile_names) && !isset($modules[$key]->info['hidden'])) { $modules[$key]->info['hidden'] = TRUE; }