summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwebchick2013-08-12 06:05:34 (GMT)
committerwebchick2013-08-12 06:05:34 (GMT)
commit859642ea2edca0a782f5fe73ddabb9b51bb1e190 (patch)
tree06caea6dfce61841a8b636305938f75da5504de9
parentaf411e00dadf5acfddfe18cd85a1b08eea4d6b0b (diff)
Issue #1888734 by catch, katbailey: Get rid of all 'bootstrap' hooks.
-rw-r--r--core/includes/bootstrap.inc26
-rw-r--r--core/includes/common.inc6
-rw-r--r--core/includes/update.inc4
-rw-r--r--core/lib/Drupal/Core/Extension/CachedModuleHandler.php18
-rw-r--r--core/lib/Drupal/Core/Extension/ModuleHandler.php32
-rw-r--r--core/lib/Drupal/Core/Extension/ModuleHandlerInterface.php10
-rw-r--r--core/modules/system/system.module18
7 files changed, 5 insertions, 109 deletions
diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc
index e8dd011..81356fc 100644
--- a/core/includes/bootstrap.inc
+++ b/core/includes/bootstrap.inc
@@ -1007,22 +1007,6 @@ function drupal_page_is_cacheable($allow_caching = NULL) {
}
/**
- * 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.
*
* This prevents including a theme, engine, module, etc., more than once.
@@ -1325,13 +1309,6 @@ function drupal_serve_page_from_cache(stdClass $cache, Response $response, Reque
}
/**
- * 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.
*
* The t() function serves two purposes. First, at run-time it translates
@@ -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 3faf0cc..be2f2a4 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 d3baaef..b106258 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 7f43ba4..295cead 100644
--- a/core/lib/Drupal/Core/Extension/CachedModuleHandler.php
+++ b/core/lib/Drupal/Core/Extension/CachedModuleHandler.php
@@ -46,24 +46,6 @@ class CachedModuleHandler extends ModuleHandler implements CachedModuleHandlerIn
}
/**
- * 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().
*/
public function getHookInfo() {
diff --git a/core/lib/Drupal/Core/Extension/ModuleHandler.php b/core/lib/Drupal/Core/Extension/ModuleHandler.php
index 6bc848e..086c125 100644
--- a/core/lib/Drupal/Core/Extension/ModuleHandler.php
+++ b/core/lib/Drupal/Core/Extension/ModuleHandler.php
@@ -29,13 +29,6 @@ class ModuleHandler implements ModuleHandlerInterface {
protected $loadedFiles;
/**
- * List of enabled bootstrap modules.
- *
- * @var array
- */
- protected $bootstrapModules;
-
- /**
* List of enabled modules.
*
* @var array
@@ -125,17 +118,6 @@ class ModuleHandler implements ModuleHandlerInterface {
}
/**
- * 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().
*/
public function isLoaded() {
@@ -160,15 +142,6 @@ class ModuleHandler implements ModuleHandlerInterface {
}
/**
- * 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().
*/
public function buildModuleDependencies(array $modules) {
@@ -649,10 +622,6 @@ class ModuleHandler implements ModuleHandlerInterface {
$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 @@ class ModuleHandler implements ModuleHandlerInterface {
// 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 83566b4..b93e3e8 100644
--- a/core/lib/Drupal/Core/Extension/ModuleHandlerInterface.php
+++ b/core/lib/Drupal/Core/Extension/ModuleHandlerInterface.php
@@ -35,11 +35,6 @@ interface ModuleHandlerInterface {
public function loadAll();
/**
- * Loads all enabled bootstrap modules.
- */
- public function loadBootstrapModules();
-
- /**
* Returns whether all modules have been loaded.
*
* @return bool
@@ -72,11 +67,6 @@ interface ModuleHandlerInterface {
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.
*
* @param array $modules
diff --git a/core/modules/system/system.module b/core/modules/system/system.module
index 76eae7f..536e6d2 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.
@@ -2618,23 +2617,6 @@ function system_rebuild_module_data() {
}
/**
- * 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.
*
* @return