You are here

function dynamic_cache_bootfix_boot in Dynamic Cache 7

Implements hook_boot().

File

./dynamic_cache_bootfix.module, line 12
Dynamic Cache Bootfix module.

Code

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;
  }
}