diff options
Diffstat (limited to 'includes/bootstrap.inc')
-rw-r--r-- | includes/bootstrap.inc | 69 |
1 files changed, 32 insertions, 37 deletions
diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc index 433641755..11f69c539 100644 --- a/includes/bootstrap.inc +++ b/includes/bootstrap.inc @@ -885,12 +885,23 @@ function _drupal_bootstrap($phase) { case DRUPAL_BOOTSTRAP_CONFIGURATION: drupal_unset_globals(); + // Start a page timer: + timer_start('page'); // Initialize the configuration conf_init(); break; case DRUPAL_BOOTSTRAP_EARLY_PAGE_CACHE: - _drupal_cache_init($phase); + // Allow specifying special cache handlers in settings.php, like + // using memcached or files for storing cache information. + require_once variable_get('cache_inc', './includes/cache.inc'); + // If the page_cache_fastpath is set to TRUE in settings.php and + // page_cache_fastpath (implemented in the special implementation of + // cache.inc) printed the page and indicated this with a returned TRUE + // then we are done. + if (variable_get('page_cache_fastpath', FALSE) && page_cache_fastpath()) { + exit; + } break; case DRUPAL_BOOTSTRAP_DATABASE: @@ -917,13 +928,26 @@ function _drupal_bootstrap($phase) { case DRUPAL_BOOTSTRAP_LATE_PAGE_CACHE: // Initialize configuration variables, using values from settings.php if available. $conf = variable_init(isset($conf) ? $conf : array()); - - _drupal_cache_init($phase); - - // Start a page timer: - timer_start('page'); - - bootstrap_invoke_all('boot'); + // Load module handling. + require_once './includes/module.inc'; + $cache_mode = variable_get('cache', CACHE_DISABLED); + // Get the page from the cache. + $cache = $cache_mode == CACHE_DISABLED ? '' : page_get_cache(); + // If the skipping of the bootstrap hooks is not enforced, call hook_boot. + if ($cache_mode != CACHE_AGGRESSIVE) { + bootstrap_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'); + } + // We are done. + exit; + } + // Prepare for non-cached page workflow. drupal_page_header(); break; @@ -945,35 +969,6 @@ function _drupal_bootstrap($phase) { } /** - * Initialize the caching strategy, which loads at different stages within - * Drupal's bootstrap process. - */ -function _drupal_cache_init($phase) { - require_once variable_get('cache_inc', './includes/cache.inc'); - - if ($phase == DRUPAL_BOOTSTRAP_EARLY_PAGE_CACHE && variable_get('page_cache_fastpath', 0)) { - if (page_cache_fastpath()) { - exit(); - } - } - elseif ($phase == DRUPAL_BOOTSTRAP_LATE_PAGE_CACHE) { - if ($cache = page_get_cache()) { - if (variable_get('cache', CACHE_DISABLED) == CACHE_AGGRESSIVE) { - drupal_page_cache_header($cache); - exit(); - } - elseif (variable_get('cache', CACHE_DISABLED) == CACHE_NORMAL) { - require_once './includes/module.inc'; - drupal_page_cache_header($cache); - bootstrap_invoke_all('exit'); - exit(); - } - } - require_once './includes/module.inc'; - } -} - -/** * Enables use of the theme system without requiring database access. Since * there is not database access no theme will be enabled and the default * themeable functions will be called. Some themeable functions can not be used |