diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index e8dd01144ebadd062dc041ce7db3de2c655fe455..81356fcf4c34bfec0ae3b8d5930f1fa677d3a92d 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -1006,22 +1006,6 @@ function drupal_page_is_cacheable($allow_caching = NULL) { && !drupal_is_cli(); } -/** - * Invokes a bootstrap hook in all bootstrap modules that implement it. - * - * @param $hook - * The name of the bootstrap hook to invoke. - * - * @see bootstrap_hooks() - */ -function bootstrap_invoke_all($hook) { - $module_handler = Drupal::moduleHandler(); - foreach ($module_handler->getBootstrapModules() as $module) { - $module_handler->load($module); - module_invoke($module, $hook); - } -} - /** * Includes a file with the provided type and name. * @@ -1324,13 +1308,6 @@ function drupal_serve_page_from_cache(stdClass $cache, Response $response, Reque $response->setContent($cache->data['body']); } -/** - * Defines the critical hooks that force modules to always be loaded. - */ -function bootstrap_hooks() { - return array('watchdog'); -} - /** * Translates a string to the current language or to a given language. * @@ -2120,9 +2097,6 @@ function _drupal_bootstrap_variables() { // Load variables from the database, but do not overwrite variables set in settings.php. $conf = variable_initialize(isset($conf) ? $conf : array()); - // Load bootstrap modules. - require_once __DIR__ . '/module.inc'; - Drupal::moduleHandler()->loadBootstrapModules(); } /** diff --git a/core/includes/common.inc b/core/includes/common.inc index 3faf0cc3ba06b9e6c62dced352af669d6f71532f..be2f2a485dc23670a5c97092ec79d33ad5303934 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -3084,6 +3084,7 @@ function drupal_valid_token($token, $value = '', $skip_anonymous = FALSE) { */ function _drupal_bootstrap_code() { require_once __DIR__ . '/../../' . settings()->get('path_inc', 'core/includes/path.inc'); + require_once __DIR__ . '/module.inc'; require_once __DIR__ . '/theme.inc'; require_once __DIR__ . '/pager.inc'; require_once __DIR__ . '/../../' . settings()->get('menu_inc', 'core/includes/menu.inc'); @@ -4732,11 +4733,6 @@ function drupal_flush_all_caches() { // actually loaded. $module_handler->loadAll(); - // Update the list of bootstrap modules. - // Allows developers to get new bootstrap hooks implementations registered - // without having to write a hook_update_N() function. - _system_update_bootstrap_status(); - // Rebuild the schema and cache a fully-built schema based on new module data. // This is necessary for any invocation of index.php, because setting cache // table entries requires schema information and that occurs during bootstrap diff --git a/core/includes/update.inc b/core/includes/update.inc index d3baaef6acba2bf7c2fddbc8adab20e46967e086..b106258258c73b9b9bbdbed3621ea6530fbafb0a 100644 --- a/core/includes/update.inc +++ b/core/includes/update.inc @@ -143,6 +143,10 @@ function update_prepare_d8_bootstrap() { // Bootstrap the database. drupal_bootstrap(DRUPAL_BOOTSTRAP_DATABASE); + // module.inc is not yet loaded but there are calls to module_config_sort() + // below. + require_once __DIR__ . '/module.inc'; + // If the site has not updated to Drupal 8 yet, check to make sure that it is // running an up-to-date version of Drupal 7 before proceeding. Note this has // to happen AFTER the database bootstraps because of diff --git a/core/lib/Drupal/Core/Extension/CachedModuleHandler.php b/core/lib/Drupal/Core/Extension/CachedModuleHandler.php index 7f43ba4c2c2c3eccd8c2a4317898efd001ad7d45..295cead8fbce57b0d7c3147cc2587dee356faa74 100644 --- a/core/lib/Drupal/Core/Extension/CachedModuleHandler.php +++ b/core/lib/Drupal/Core/Extension/CachedModuleHandler.php @@ -45,24 +45,6 @@ public function __construct(array $module_list = array(), KeyValueStoreInterface $this->bootstrapCache = $bootstrap_cache; } - /** - * Implements \Drupal\Core\Extension\ModuleHandlerInterface::getBootstrapModules(). - */ - public function getBootstrapModules() { - if (isset($this->bootstrapModules)) { - return $this->bootstrapModules; - } - if ($cached = $this->bootstrapCache->get('bootstrap_modules')) { - $bootstrap_list = $cached->data; - } - else { - $bootstrap_list = $this->state->get('system.module.bootstrap') ?: array(); - $this->bootstrapCache->set('bootstrap_modules', $bootstrap_list); - } - $this->bootstrapModules = array_keys($bootstrap_list); - return $this->bootstrapModules; - } - /** * Overrides \Drupal\Core\Extension\ModuleHandler::getHookInfo(). */ diff --git a/core/lib/Drupal/Core/Extension/ModuleHandler.php b/core/lib/Drupal/Core/Extension/ModuleHandler.php index 6bc848ef1993876dc3c16deeb9104fe5a60bf774..086c1253522a21b9874ad58f615a18b37dca4a71 100644 --- a/core/lib/Drupal/Core/Extension/ModuleHandler.php +++ b/core/lib/Drupal/Core/Extension/ModuleHandler.php @@ -28,13 +28,6 @@ class ModuleHandler implements ModuleHandlerInterface { */ protected $loadedFiles; - /** - * List of enabled bootstrap modules. - * - * @var array - */ - protected $bootstrapModules; - /** * List of enabled modules. * @@ -124,17 +117,6 @@ public function reload() { $this->loadAll(); } - /** - * Implements \Drupal\Core\Extension\ModuleHandlerInterface::loadBootstrapModules(). - */ - public function loadBootstrapModules() { - if (!$this->loaded) { - foreach ($this->getBootstrapModules() as $module) { - $this->load($module); - } - } - } - /** * Implements \Drupal\Core\Extension\ModuleHandlerInterface::isLoaded(). */ @@ -159,15 +141,6 @@ public function setModuleList(array $module_list = array()) { $this->resetImplementations(); } - /** - * Implements \Drupal\Core\Extension\ModuleHandlerInterface::getBootstrapModules(). - */ - public function getBootstrapModules() { - // The basic module handler does not know anything about how to retrieve a - // list of bootstrap modules. - return array(); - } - /** * Implements \Drupal\Core\Extension\ModuleHandlerInterface::buildModuleDependencies(). */ @@ -649,10 +622,6 @@ public function enable($module_list, $enable_dependencies = TRUE) { $kernel->updateModules($module_filenames, $module_filenames); } - // Refresh the list of modules that implement bootstrap hooks. - // @see bootstrap_hooks() - _system_update_bootstrap_status(); - // Refresh the schema to include it. drupal_get_schema(NULL, TRUE); // Update the theme registry to include it. @@ -796,7 +765,6 @@ function disable($module_list, $disable_dependents = TRUE) { // Invoke hook_modules_disabled before disabling modules, // so we can still call module hooks to get information. $this->invokeAll('modules_disabled', array($invoke_modules)); - _system_update_bootstrap_status(); // Update the kernel to exclude the disabled modules. $enabled = $this->getModuleList(); diff --git a/core/lib/Drupal/Core/Extension/ModuleHandlerInterface.php b/core/lib/Drupal/Core/Extension/ModuleHandlerInterface.php index 83566b43d69d8a4dc2f0b5b80187e067356edf76..b93e3e8a32c2f88433acae062e0e4bb86ae8c710 100644 --- a/core/lib/Drupal/Core/Extension/ModuleHandlerInterface.php +++ b/core/lib/Drupal/Core/Extension/ModuleHandlerInterface.php @@ -34,11 +34,6 @@ public function load($name); */ public function loadAll(); - /** - * Loads all enabled bootstrap modules. - */ - public function loadBootstrapModules(); - /** * Returns whether all modules have been loaded. * @@ -71,11 +66,6 @@ public function getModuleList(); */ public function setModuleList(array $module_list = array()); - /** - * Retrieves the list of bootstrap modules. - */ - public function getBootstrapModules(); - /** * Determines which modules require and are required by each module. * diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 76eae7f6cf8a2d417b7b5165a591817df51b3238..536e6d2f13c05e2425b93e209404d827f6799a0d 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -2531,7 +2531,6 @@ function _system_rebuild_module_data() { 'version' => NULL, 'php' => DRUPAL_MINIMUM_PHP, 'files' => array(), - 'bootstrap' => 0, ); // Read info files for each module. @@ -2617,23 +2616,6 @@ function system_rebuild_module_data() { return $modules_cache; } -/** - * Refreshes the list of bootstrap modules. - * - * This is called internally by module_enable/disable() to flag modules that - * implement hooks used during bootstrap, such as hook_watchdog(). These modules - * are loaded earlier to invoke the hooks. - */ -function _system_update_bootstrap_status() { - $bootstrap_modules = array(); - foreach (bootstrap_hooks() as $hook) { - foreach (Drupal::moduleHandler()->getImplementations($hook) as $module) { - $bootstrap_modules[$module] = drupal_get_filename('module', $module); - } - } - Drupal::state()->set('system.module.bootstrap', $bootstrap_modules); -} - /** * Helper function to scan and collect theme .info.yml data and their engines. *