dynamic_cache_bootfix.module in Dynamic Cache 7
Dynamic Cache Bootfix module.
Fixes a problem where Dynamic Cache causes hook_boot() to be invoked twice.
File
dynamic_cache_bootfix.moduleView source
<?php
/**
* @file
* Dynamic Cache Bootfix module.
*
* Fixes a problem where Dynamic Cache causes hook_boot() to be invoked twice.
*/
/**
* Implements hook_boot().
*/
function dynamic_cache_bootfix_boot() {
static $flag = FALSE;
if ($flag) {
// We've run before, so let's prevent other hook_boot()'s from running.
// First we need to finish the remaining steps from _drupal_bootstrap_page_header().
if (!drupal_is_cli()) {
ob_start();
drupal_page_header();
}
// Re-run full bootstrap and menu handler from index.php again (DOUBLE HIJACK!).
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL, true);
menu_execute_active_handler();
// We're done.
exit;
}
else {
$flag = TRUE;
// If this is the first pass then no other modules' hook_boot has run yet
// and we can capture the "core" cache setting before it's touched.
$GLOBALS['conf']['dynamic_cache_orig_cache'] = isset($GLOBALS['conf']['cache']) ? $GLOBALS['conf']['cache'] : FALSE;
}
}Functions
|
Name |
Description |
|---|---|
| dynamic_cache_bootfix_boot | Implements hook_boot(). |