summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDries Buytaert2008-11-24 10:41:40 (GMT)
committerDries Buytaert2008-11-24 10:41:40 (GMT)
commit5083e13522d29f0865144a02f448a084818b2f06 (patch)
treecbc62a6b74122cc2cea59ed955e85306e2faab01
parent8e985b3fbc5ca8e113ed0f1bfa288e3eb2bfd5a5 (diff)
- Patch #333143 by justinrandell: cleaning up the Drupal bootstrap code, removing bootstrap flag in system table.
-rw-r--r--includes/bootstrap.inc25
-rw-r--r--includes/install.inc2
-rw-r--r--includes/module.inc32
-rw-r--r--includes/theme.maintenance.inc2
-rw-r--r--install.php2
-rw-r--r--modules/system/system.admin.inc2
-rw-r--r--modules/system/system.install16
-rw-r--r--modules/system/system.module2
-rw-r--r--modules/system/system.test2
-rw-r--r--update.php2
10 files changed, 26 insertions, 61 deletions
diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc
index adf56c8..a664fc8 100644
--- a/includes/bootstrap.inc
+++ b/includes/bootstrap.inc
@@ -674,18 +674,6 @@ function page_get_cache() {
}
/**
- * Call all init or exit hooks without including all modules.
- *
- * @param $hook
- * The name of the bootstrap hook we wish to invoke.
- */
-function bootstrap_invoke_all($hook) {
- foreach (module_implements($hook) as $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.
*
@@ -790,13 +778,6 @@ function drupal_page_cache_header($cache) {
}
/**
- * Define the critical hooks that force modules to always be loaded.
- */
-function bootstrap_hooks() {
- return array('boot', 'exit');
-}
-
-/**
* Unserializes and appends elements from a serialized string.
*
* @param $obj
@@ -1157,14 +1138,14 @@ function _drupal_bootstrap($phase) {
if (!$cache || $cache_mode != CACHE_AGGRESSIVE) {
// Load module handling.
require_once DRUPAL_ROOT . '/includes/module.inc';
- bootstrap_invoke_all('boot');
+ module_invoke_all('boot');
}
// If there is a cached page, display it.
if ($cache) {
drupal_page_cache_header($cache);
// If the skipping of the bootstrap hooks is not enforced, call hook_exit.
if ($cache_mode != CACHE_AGGRESSIVE) {
- bootstrap_invoke_all('exit');
+ module_invoke_all('exit');
}
// We are done.
exit;
@@ -1368,7 +1349,7 @@ function drupal_get_schema($table = NULL, $rebuild = FALSE) {
// "prime" module_list() here to to values we want, specifically
// "yes rebuild the list and don't limit to bootstrap".
// TODO: Remove this call after http://drupal.org/node/222109 is fixed.
- module_list(TRUE, FALSE);
+ module_list(TRUE);
module_load_all_includes('install');
}
diff --git a/includes/install.inc b/includes/install.inc
index 4bbd060..8902d34 100644
--- a/includes/install.inc
+++ b/includes/install.inc
@@ -571,7 +571,7 @@ function drupal_install_system() {
$system_versions = drupal_get_schema_versions('system');
$system_version = $system_versions ? max($system_versions) : SCHEMA_INSTALLED;
- db_query("INSERT INTO {system} (filename, name, type, owner, status, bootstrap, schema_version) VALUES('%s', '%s', '%s', '%s', %d, %d, %d)", $system_path . '/system.module', 'system', 'module', '', 1, 0, $system_version);
+ db_query("INSERT INTO {system} (filename, name, type, owner, status, schema_version) VALUES('%s', '%s', '%s', '%s', %d, %d)", $system_path . '/system.module', 'system', 'module', '', 1, $system_version);
// Now that we've installed things properly, bootstrap the full Drupal environment
drupal_install_init_database();
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
diff --git a/includes/module.inc b/includes/module.inc
index 9eb2eee..92b77a5 100644
--- a/includes/module.inc
+++ b/includes/module.inc
@@ -21,7 +21,7 @@ define('MODULE_IMPLEMENTS_CLEAR_CACHE', -2);
* Load all the modules that have been enabled in the system table.
*/
function module_load_all() {
- foreach (module_list(TRUE, FALSE) as $module) {
+ foreach (module_list(TRUE) as $module) {
drupal_load('module', $module);
}
}
@@ -33,9 +33,6 @@ function module_load_all() {
* @param $refresh
* Whether to force the module list to be regenerated (such as after the
* administrator has changed the system settings).
- * @param $bootstrap
- * Whether to return the reduced set of modules loaded in "bootstrap mode"
- * for cached pages. See bootstrap.inc.
* @param $sort
* By default, modules are ordered by weight and filename. Set this option to
* TRUE to return a module list ordered only by module name.
@@ -46,7 +43,7 @@ function module_load_all() {
* An associative array whose keys and values are the names of all loaded
* modules.
*/
-function module_list($refresh = FALSE, $bootstrap = TRUE, $sort = FALSE, $fixed_list = NULL) {
+function module_list($refresh = FALSE, $sort = FALSE, $fixed_list = NULL) {
static $list = array(), $sorted_list;
if (empty($list) || $refresh || $fixed_list) {
@@ -59,12 +56,7 @@ function module_list($refresh = FALSE, $bootstrap = TRUE, $sort = FALSE, $fixed_
}
}
else {
- if ($bootstrap) {
- $result = db_query("SELECT name, filename FROM {system} WHERE type = 'module' AND status = 1 AND bootstrap = 1 ORDER BY weight ASC, filename ASC");
- }
- else {
- $result = db_query("SELECT name, filename FROM {system} WHERE type = 'module' AND status = 1 ORDER BY weight ASC, filename ASC");
- }
+ $result = db_query("SELECT name, filename FROM {system} WHERE type = 'module' AND status = 1 ORDER BY weight ASC, filename ASC");
while ($module = db_fetch_object($result)) {
if (file_exists($module->filename)) {
drupal_get_filename('module', $module->name, $module->filename);
@@ -125,24 +117,14 @@ function module_rebuild_cache() {
// modify the data in the .info files if necessary.
drupal_alter('system_info', $files[$filename]->info, $files[$filename]);
- // Log the critical hooks implemented by this module.
- $bootstrap = 0;
- foreach (bootstrap_hooks() as $hook) {
- // Only look for hooks in installed modules.
- if (!empty($file->status) && in_array($file->name, module_implements($hook))) {
- $bootstrap = 1;
- break;
- }
- }
-
// Update the contents of the system table:
if (isset($file->status) || (isset($file->old_filename) && $file->old_filename != $file->filename)) {
- db_query("UPDATE {system} SET info = '%s', name = '%s', filename = '%s', bootstrap = %d WHERE filename = '%s'", serialize($files[$filename]->info), $file->name, $file->filename, $bootstrap, $file->old_filename);
+ db_query("UPDATE {system} SET info = '%s', name = '%s', filename = '%s' WHERE filename = '%s'", serialize($files[$filename]->info), $file->name, $file->filename, $file->old_filename);
}
else {
// This is a new module.
$files[$filename]->status = 0;
- db_query("INSERT INTO {system} (name, info, type, filename, status, bootstrap) VALUES ('%s', '%s', '%s', '%s', %d, %d)", $file->name, serialize($files[$filename]->info), 'module', $file->filename, 0, $bootstrap);
+ db_query("INSERT INTO {system} (name, info, type, filename, status) VALUES ('%s', '%s', '%s', '%s', %d)", $file->name, serialize($files[$filename]->info), 'module', $file->filename, 0);
}
}
$files = _module_build_dependencies($files);
@@ -295,7 +277,7 @@ function module_enable($module_list) {
if (!empty($invoke_modules)) {
// Refresh the module list to include the new enabled module.
- module_list(TRUE, FALSE);
+ module_list(TRUE);
// Force to regenerate the stored list of hook implementations.
registry_rebuild();
}
@@ -345,7 +327,7 @@ function module_disable($module_list) {
// so we can still call module hooks to get information.
module_invoke_all('modules_disabled', $invoke_modules);
// Refresh the module list to exclude the disabled modules.
- module_list(TRUE, FALSE);
+ module_list(TRUE);
// Force to regenerate the stored list of hook implementations.
registry_rebuild();
}
diff --git a/includes/theme.maintenance.inc b/includes/theme.maintenance.inc
index f64fd42..e88ebce 100644
--- a/includes/theme.maintenance.inc
+++ b/includes/theme.maintenance.inc
@@ -39,7 +39,7 @@ function _drupal_maintenance_theme() {
// Load module basics (needed for hook invokes).
$module_list['system']['filename'] = 'modules/system/system.module';
$module_list['filter']['filename'] = 'modules/filter/filter.module';
- module_list(TRUE, FALSE, FALSE, $module_list);
+ module_list(TRUE, FALSE, $module_list);
drupal_load('module', 'system');
drupal_load('module', 'filter');
diff --git a/install.php b/install.php
index 9b91d56..05654a4 100644
--- a/install.php
+++ b/install.php
@@ -52,7 +52,7 @@ function install_main() {
include_once DRUPAL_ROOT . '/includes/module.inc';
$module_list['system']['filename'] = 'modules/system/system.module';
$module_list['filter']['filename'] = 'modules/filter/filter.module';
- module_list(TRUE, FALSE, FALSE, $module_list);
+ module_list(TRUE, FALSE, $module_list);
drupal_load('module', 'system');
drupal_load('module', 'filter');
diff --git a/modules/system/system.admin.inc b/modules/system/system.admin.inc
index 970c048..99033a3 100644
--- a/modules/system/system.admin.inc
+++ b/modules/system/system.admin.inc
@@ -940,7 +940,7 @@ function system_modules_submit($form, &$form_state) {
drupal_install_modules($new_modules);
}
- $current_module_list = module_list(TRUE, FALSE);
+ $current_module_list = module_list(TRUE);
if ($old_module_list != $current_module_list) {
drupal_set_message(t('The configuration options have been saved.'));
}
diff --git a/modules/system/system.install b/modules/system/system.install
index bcde1b9..ae9cd81 100644
--- a/modules/system/system.install
+++ b/modules/system/system.install
@@ -1208,12 +1208,6 @@ function system_schema() {
'not null' => TRUE,
'default' => 0,
),
- 'bootstrap' => array(
- 'description' => "Boolean indicating whether this module is loaded during Drupal's early bootstrapping phase (e.g. even before the page cache is consulted).",
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- ),
'schema_version' => array(
'description' => "The module's database schema version number. -1 if the module is not installed (its tables do not exist); 0 or the largest N of the module's hook_update_N() function that has either been run or existed when the module was first installed.",
'type' => 'int',
@@ -1236,7 +1230,6 @@ function system_schema() {
'primary key' => array('filename'),
'indexes' => array(
'modules' => array(array('type', 12), 'status', 'weight', 'filename'),
- 'bootstrap' => array(array('type', 12), 'status', 'bootstrap', 'weight', 'filename'),
),
);
@@ -3131,6 +3124,15 @@ function system_update_7013() {
}
/**
+ * Drop the bootstrap column from the {system} table.
+ */
+function system_update_7014() {
+ $ret = array();
+ db_drop_field($ret, 'system', 'bootstrap');
+ return $ret;
+}
+
+/**
* @} End of "defgroup updates-6.x-to-7.x"
* The next series of updates should start at 8000.
*/
diff --git a/modules/system/system.module b/modules/system/system.module
index 151c269..833e545 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -1088,7 +1088,7 @@ function system_theme_data() {
$theme->owner = '';
}
- db_query("INSERT INTO {system} (name, owner, info, type, filename, status, bootstrap) VALUES ('%s', '%s', '%s', '%s', '%s', %d, %d)", $theme->name, $theme->owner, serialize($theme->info), 'theme', $theme->filename, isset($theme->status) ? $theme->status : 0, 0);
+ db_query("INSERT INTO {system} (name, owner, info, type, filename, status) VALUES ('%s', '%s', '%s', '%s', '%s', %d)", $theme->name, $theme->owner, serialize($theme->info), 'theme', $theme->filename, isset($theme->status) ? $theme->status : 0);
}
return $themes;
diff --git a/modules/system/system.test b/modules/system/system.test
index 756b6c1..a88cef4 100644
--- a/modules/system/system.test
+++ b/modules/system/system.test
@@ -133,7 +133,7 @@ class EnableDisableCoreTestCase extends DrupalWebTestCase {
* @param boolean $enabled Module state.
*/
function assertModules(Array $modules, $enabled) {
- module_list(TRUE, FALSE);
+ module_list(TRUE);
foreach ($modules as $module) {
if ($enabled) {
$message = 'Module "@module" is enabled.';
diff --git a/update.php b/update.php
index 937e98f..0cefcb7 100644
--- a/update.php
+++ b/update.php
@@ -663,7 +663,7 @@ if (empty($op)) {
include_once DRUPAL_ROOT . '/includes/module.inc';
$module_list['system']['filename'] = 'modules/system/system.module';
$module_list['filter']['filename'] = 'modules/filter/filter.module';
- module_list(TRUE, FALSE, FALSE, $module_list);
+ module_list(TRUE, FALSE, $module_list);
drupal_load('module', 'system');
drupal_load('module', 'filter');