diff -u b/core/includes/install.inc b/core/includes/install.inc --- b/core/includes/install.inc +++ b/core/includes/install.inc @@ -556,7 +556,7 @@ $info = $install_state['profile_info']; // Get the list of available modules for the selected installation profile. - $listing = new ExtensionDiscovery(DRUPAL_ROOT); + $listing = new ExtensionDiscovery(\Drupal::root()); $present_modules = array(); foreach ($listing->scan('module') as $present_module) { $present_modules[] = $present_module->getName(); @@ -923,10 +923,10 @@ // Collect requirement testing results. $requirements = array(); - $listing = new ExtensionDiscovery(DRUPAL_ROOT); + $listing = new ExtensionDiscovery(\Drupal::root()); $module_list = $listing->scan('module'); foreach ($info['dependencies'] as $module) { - $file = DRUPAL_ROOT . '/' . $module_list[$module]->getPath() . "/$module.install"; + $file = \Drupal::root() . '/' . $module_list[$module]->getPath() . "/$module.install"; if (is_file($file)) { require_once $file; } diff -u b/core/lib/Drupal/Core/Config/ExtensionInstallStorage.php b/core/lib/Drupal/Core/Config/ExtensionInstallStorage.php --- b/core/lib/Drupal/Core/Config/ExtensionInstallStorage.php +++ b/core/lib/Drupal/Core/Config/ExtensionInstallStorage.php @@ -85,7 +85,7 @@ $install_profile = Settings::get('install_profile'); $extensions = $this->configStorage->read('core.extension'); - $listing = new ExtensionDiscovery(DRUPAL_ROOT); + $listing = new ExtensionDiscovery(\Drupal::root()); if (!empty($extensions['module'])) { $modules = $extensions['module']; // Remove the install profile as this is handled later. diff -u b/core/lib/Drupal/Core/Config/InstallStorage.php b/core/lib/Drupal/Core/Config/InstallStorage.php --- b/core/lib/Drupal/Core/Config/InstallStorage.php +++ b/core/lib/Drupal/Core/Config/InstallStorage.php @@ -159,7 +159,7 @@ if (!isset($this->folders)) { $this->folders = array(); $this->folders += $this->getCoreNames(); - $listing = new ExtensionDiscovery(DRUPAL_ROOT); + $listing = new ExtensionDiscovery(\Drupal::root()); if ($profile = drupal_get_profile()) { $profile_list = $listing->scan('profile'); if (isset($profile_list[$profile])) { @@ -185,9 +185,11 @@ $extension = '.' . $this->getFileExtension(); $folders = array(); foreach ($list as $extension_object) { + // We don't have to use ExtensionDiscovery here because our list of + // extensions was already obtained through an ExtensionDiscovery scan. $directory = $this->getComponentFolder($extension_object); if (file_exists($directory)) { - $files = new \GlobIterator(DRUPAL_ROOT . '/' . $directory . '/*' . $extension); + $files = new \GlobIterator(\Drupal::root() . '/' . $directory . '/*' . $extension); foreach ($files as $file) { $folders[$file->getBasename($extension)] = $directory; } @@ -207,7 +209,7 @@ $folders = array(); $directory = $this->getCoreFolder(); if (file_exists($directory)) { - $files = new \GlobIterator(DRUPAL_ROOT . '/' . $directory . '/*' . $extension); + $files = new \GlobIterator(\Drupal::root() . '/' . $directory . '/*' . $extension); foreach ($files as $file) { $folders[$file->getBasename($extension)] = $directory; } diff -u b/core/modules/simpletest/src/KernelTestBase.php b/core/modules/simpletest/src/KernelTestBase.php --- b/core/modules/simpletest/src/KernelTestBase.php +++ b/core/modules/simpletest/src/KernelTestBase.php @@ -484,7 +484,7 @@ * The new modules are only added to the active module list and loaded. */ protected function enableModules(array $modules) { - $listing = new ExtensionDiscovery(DRUPAL_ROOT); + $listing = new ExtensionDiscovery(\Drupal::root()); $module_list = $listing->scan('module'); // In ModuleHandlerTest we pass in a profile as if it were a module. $module_list += $listing->scan('profile');