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 @@ -8,6 +8,7 @@ namespace Drupal\Core\Config; use Drupal\Core\Site\Settings; +use Drupal\Core\Extension\ExtensionDiscovery; /** * Storage to access configuration and schema in enabled extensions. @@ -80,18 +81,28 @@ protected function getAllFolders() { if (!isset($this->folders)) { $this->folders = array(); - $this->folders += $this->getComponentNames('core', array('core')); + $this->folders += $this->getCoreNames(); $install_profile = Settings::get('install_profile'); $extensions = $this->configStorage->read('core.extension'); + $listing = new ExtensionDiscovery(DRUPAL_ROOT); if (!empty($extensions['module'])) { $modules = $extensions['module']; // Remove the install profile as this is handled later. unset($modules[$install_profile]); - $this->folders += $this->getComponentNames('module', array_keys($modules)); + $module_list_scan = $listing->scan('module'); + $module_list = array(); + foreach (array_keys($modules) as $module) { + $module_list[$module] = $module_list_scan[$module]; + } + $this->folders += $this->getComponentNames($module_list); } if (!empty($extensions['theme'])) { - $this->folders += $this->getComponentNames('theme', array_keys($extensions['theme'])); + $theme_list_scan = $listing->scan('theme'); + foreach (array_keys($extensions['theme']) as $theme) { + $theme_list[$theme] = $theme_list_scan[$theme]; + } + $this->folders += $this->getComponentNames($theme_list); } if ($this->includeProfile) { @@ -100,7 +111,8 @@ // install profile version if there are any duplicates. $profile = drupal_get_profile(); if (isset($profile)) { - $profile_folders = $this->getComponentNames('profile', array($profile)); + $profile_list = $listing->scan('profile'); + $profile_folders = $this->getComponentNames(array($profile_list[$profile])); $this->folders = $profile_folders + $this->folders; } } only in patch2: unchanged: --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -302,6 +302,10 @@ function install_begin_request($class_loader, &$install_state) { // Allow command line scripts to override server variables used by Drupal. require_once __DIR__ . '/bootstrap.inc'; + // Prime the drupal_get_filename() cache with the location of the system + // module. + drupal_get_filename('module', 'system', 'core/modules/system/system.info.yml'); + // If the hash salt leaks, it becomes possible to forge a valid testing user // agent, install a new copy of Drupal, and take over the original site. // The user agent header is used to pass a database prefix in the request when @@ -1031,6 +1035,7 @@ function install_base_system(&$install_state) { // Enable the user module so that sessions can be recorded during the // upcoming bootstrap step. + system_rebuild_module_data(); \Drupal::service('module_installer')->install(array('user'), FALSE); // Save the list of other modules to install for the upcoming tasks. only in patch2: unchanged: --- a/core/includes/install.inc +++ b/core/includes/install.inc @@ -922,11 +922,19 @@ function drupal_check_profile($profile, array $install_state) { // Collect requirement testing results. $requirements = array(); + + $listing = new ExtensionDiscovery(DRUPAL_ROOT); + $module_list = $listing->scan('module'); + // Make sure the installation API is available + include_once __DIR__ . '/install.inc'; foreach ($info['dependencies'] as $module) { - module_load_install($module); + $file = DRUPAL_ROOT . '/' . $module_list[$module]->getPath() . "/$module.install"; + if (is_file($file)) { + require_once $file; + } $function = $module . '_requirements'; - drupal_classloader_register($module, drupal_get_path('module', $module)); + drupal_classloader_register($module, $module_list[$module]->getPath()); if (function_exists($function)) { $requirements = array_merge($requirements, $function('install')); } only in patch2: unchanged: --- a/core/lib/Drupal/Core/Config/InstallStorage.php +++ b/core/lib/Drupal/Core/Config/InstallStorage.php @@ -8,6 +8,7 @@ namespace Drupal\Core\Config; use Drupal\Core\Extension\ExtensionDiscovery; +use Drupal\Core\Extension\Extension; /** * Storage used by the Drupal installer. @@ -157,14 +158,14 @@ public function listAll($prefix = '') { protected function getAllFolders() { if (!isset($this->folders)) { $this->folders = array(); - $this->folders += $this->getComponentNames('core', array('core')); - // @todo Refactor getComponentNames() to use the extension list directly. + $this->folders += $this->getCoreNames(); + $listing = new ExtensionDiscovery(DRUPAL_ROOT); if ($profile = drupal_get_profile()) { - $this->folders += $this->getComponentNames('profile', array($profile)); + $profile_list = $listing->scan('profile'); + $this->folders += $this->getComponentNames(array($profile_list[$profile])); } - $listing = new ExtensionDiscovery(DRUPAL_ROOT); - $this->folders += $this->getComponentNames('module', array_keys($listing->scan('module'))); - $this->folders += $this->getComponentNames('theme', array_keys($listing->scan('theme'))); + $this->folders += $this->getComponentNames($listing->scan('module')); + $this->folders += $this->getComponentNames($listing->scan('theme')); } return $this->folders; } @@ -172,19 +173,17 @@ protected function getAllFolders() { /** * Get all configuration names and folders for a list of modules or themes. * - * @param string $type - * Type of components: 'module' | 'theme' | 'profile' - * @param array $list - * Array of theme or module names. + * @param \Drupal\Core\Extension\Extension[] $list + * An associative array of Extension objects, keyed by extension name. * * @return array * Folders indexed by configuration name. */ - public function getComponentNames($type, array $list) { + public function getComponentNames(array $list) { $extension = '.' . $this->getFileExtension(); $folders = array(); - foreach ($list as $name) { - $directory = $this->getComponentFolder($type, $name); + foreach ($list as $extension_object) { + $directory = $this->getComponentFolder($extension_object); if (file_exists($directory)) { $files = new \GlobIterator(DRUPAL_ROOT . '/' . $directory . '/*' . $extension); foreach ($files as $file) { @@ -196,18 +195,45 @@ public function getComponentNames($type, array $list) { } /** + * Get all configuration names and folders for Drupal core. + * + * @return array + * Folders indexed by configuration name. + */ + public function getCoreNames() { + $extension = '.' . $this->getFileExtension(); + $folders = array(); + $directory = $this->getCoreFolder(); + if (file_exists($directory)) { + $files = new \GlobIterator(DRUPAL_ROOT . '/' . $directory . '/*' . $extension); + foreach ($files as $file) { + $folders[$file->getBasename($extension)] = $directory; + } + } + return $folders; + } + + /** * Get folder inside each component that contains the files. * - * @param string $type - * Component type: 'module' | 'theme' | 'profile' - * @param string $name - * Component name. + * @param \Drupal\Core\Extension\Extension $extension + * The Extension object for the component. * * @return string * The configuration folder name for this component. */ - protected function getComponentFolder($type, $name) { - return drupal_get_path($type, $name) . '/' . $this->getCollectionDirectory(); + protected function getComponentFolder(Extension $extension) { + return $extension->getPath() . '/' . $this->getCollectionDirectory(); + } + + /** + * Get folder inside Drupal core that contains the files. + * + * @return string + * The configuration folder name for core. + */ + protected function getCoreFolder() { + return drupal_get_path('core', 'core') . '/' . $this->getCollectionDirectory(); } /** only in patch2: unchanged: --- a/core/lib/Drupal/Core/Extension/ModuleInstaller.php +++ b/core/lib/Drupal/Core/Extension/ModuleInstaller.php @@ -18,7 +18,7 @@ /** * Default implementation of the module installer. * - * It registers the module in config, install its own configuration, + * It registers the module in config, installs its own configuration, * installs the schema, updates the Drupal kernel and more. */ class ModuleInstaller implements ModuleInstallerInterface { only in patch2: unchanged: --- a/core/modules/config/tests/config_test/src/TestInstallStorage.php +++ b/core/modules/config/tests/config_test/src/TestInstallStorage.php @@ -23,13 +23,12 @@ class TestInstallStorage extends InstallStorage { */ protected function getAllFolders() { if (!isset($this->folders)) { - $this->folders = $this->getComponentNames('core', array('core')); - // @todo Refactor getComponentNames() to use the extension list directly. + $this->folders = $this->getCoreNames(); $listing = new ExtensionDiscovery(\Drupal::root()); $listing->setProfileDirectories(array()); - $this->folders += $this->getComponentNames('profile', array_keys($listing->scan('profile'))); - $this->folders += $this->getComponentNames('module', array_keys($listing->scan('module'))); - $this->folders += $this->getComponentNames('theme', array_keys($listing->scan('theme'))); + $this->folders += $this->getComponentNames($listing->scan('profile')); + $this->folders += $this->getComponentNames($listing->scan('module')); + $this->folders += $this->getComponentNames($listing->scan('theme')); } return $this->folders; }