You are here

function dynamic_cache_boot in Dynamic Cache 6

Same name and namespace in other branches
  1. 7 dynamic_cache.module \dynamic_cache_boot()

Implements hook_boot().

File

./dynamic_cache.module, line 15
Dynamic Cache module.

Code

function dynamic_cache_boot() {
  if (dynamic_cache_should_run()) {

    // STEP 1: Complete remaining DRUPAL_BOOTSTRAP_LATE_PAGE_CACHE steps from
    // _drupal_bootstrap() in includes/bootstrap.inc.
    // Prepare for non-cached page workflow.
    drupal_page_header();

    // STEP 2: Execute remaining bootstrap steps.
    drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

    // STEP 3: Complete remaining steps from index.php.
    // Execute page, get output.
    $return = menu_execute_active_handler();

    // Menu status constants are integers; page content is a string.
    if (is_int($return)) {
      switch ($return) {
        case MENU_NOT_FOUND:
          drupal_not_found();
          break;
        case MENU_ACCESS_DENIED:
          drupal_access_denied();
          break;
        case MENU_SITE_OFFLINE:
          drupal_site_offline();
          break;
      }
    }
    elseif (isset($return)) {

      // Print any value (including an empty string) except NULL or undefined:
      print theme('page', $return);
    }

    // Finish page output.
    drupal_page_footer();

    // We're done.
    exit;
  }
}