diff options
author | Dries Buytaert <dries@buytaert.net> | 2008-11-24 10:41:40 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2008-11-24 10:41:40 +0000 |
commit | 5083e13522d29f0865144a02f448a084818b2f06 (patch) | |
tree | cbc62a6b74122cc2cea59ed955e85306e2faab01 /includes | |
parent | 8e985b3fbc5ca8e113ed0f1bfa288e3eb2bfd5a5 (diff) | |
download | brdo-5083e13522d29f0865144a02f448a084818b2f06.tar.gz brdo-5083e13522d29f0865144a02f448a084818b2f06.tar.bz2 |
- Patch #333143 by justinrandell: cleaning up the Drupal bootstrap code, removing bootstrap flag in system table.
Diffstat (limited to 'includes')
-rw-r--r-- | includes/bootstrap.inc | 25 | ||||
-rw-r--r-- | includes/install.inc | 2 | ||||
-rw-r--r-- | includes/module.inc | 32 | ||||
-rw-r--r-- | includes/theme.maintenance.inc | 2 |
4 files changed, 12 insertions, 49 deletions
diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc index adf56c85c..a664fc857 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 4bbd060b4..8902d3400 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 9eb2eeeae..92b77a5ba 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 f64fd4245..e88ebce93 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'); |