From c409a47fcc482a332dcfcb6b85a742205a84a935 Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Sun, 1 Nov 2009 22:10:07 +0000 Subject: #592008 follow-up by chx and moshe weitzman: All theme() function calls in hook_init(). --- includes/module.inc | 20 +++++++++++++++++--- includes/theme.inc | 2 +- 2 files changed, 18 insertions(+), 4 deletions(-) (limited to 'includes') diff --git a/includes/module.inc b/includes/module.inc index cd2821e4f..975aaf29d 100644 --- a/includes/module.inc +++ b/includes/module.inc @@ -6,16 +6,30 @@ * API for loading and interacting with Drupal modules. */ - /** * Load all the modules that have been enabled in the system table. + * + * @param $bootstrap + * Whether to load only the reduced set of modules loaded in "bootstrap mode" + * for cached pages. See bootstrap.inc. + * @return + * If $bootstrap is NULL, return a boolean indicating whether all modules + * have been loaded. */ function module_load_all($bootstrap = FALSE) { - foreach (module_list(TRUE, $bootstrap) as $module) { - drupal_load('module', $module); + static $has_run = FALSE; + + if (isset($bootstrap)) { + foreach (module_list(TRUE, $bootstrap) as $module) { + drupal_load('module', $module); + } + // $has_run will be TRUE if $bootstrap is FALSE. + $has_run = !$bootstrap; } + return $has_run; } + /** * Collect a list of all loaded modules. During the bootstrap, return only * vital modules. See bootstrap.inc diff --git a/includes/theme.inc b/includes/theme.inc index 0f1fde321..8b5c4c41b 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -258,7 +258,7 @@ function _theme_load_registry($theme, $base_theme = NULL, $theme_engine = NULL) $registry = _theme_build_registry($theme, $base_theme, $theme_engine); // Only persist this registry if all modules are loaded. This assures a // complete set of theme hooks. - if (drupal_get_bootstrap_phase() == DRUPAL_BOOTSTRAP_FULL) { + if (module_load_all(NULL)) { _theme_save_registry($theme, $registry); _theme_set_registry($registry); } -- cgit v1.2.3