You are here

function boost_deliver_html_page in Boost 7

Capture error conditions.

Parameters

$page_callback_result: The result of a page callback. Can be one of:

  • NULL: to indicate no content.
  • An integer menu status constant: to indicate an error condition.
  • A string of HTML content.
  • A renderable array of content.

See also

drupal_deliver_html_page()

1 string reference to 'boost_deliver_html_page'
boost_page_delivery_callback_alter in ./boost.module
Implements hook_page_delivery_callback_alter().

File

./boost.module, line 1485
Caches generated output as a static file to be served directly from the webserver.

Code

function boost_deliver_html_page($page_callback_result) {
  global $_boost;

  // Menu status constants are integers; page content is a string or array.
  if (is_int($page_callback_result)) {

    // @todo: Break these up into separate functions?
    switch ($page_callback_result) {
      case MENU_NOT_FOUND:

        // 404 page.
        $_boost['menu_item']['status'] = 404;
        break;
      case MENU_ACCESS_DENIED:

        // 403 page.
        $_boost['menu_item']['status'] = 403;
        break;
      case MENU_SITE_OFFLINE:

        // 503 page.
        $_boost['menu_item']['status'] = 503;
        break;
    }
  }

  // Call original function.
  drupal_deliver_html_page($page_callback_result);

  // Last possible place to send a watchdog message without a shutdown function.
  if (variable_get('boost_message_debug', BOOST_MESSAGE_DEBUG) && $_boost['args'][0] !== 'admin') {
    watchdog('boost', boost_print_r($_boost), array(), WATCHDOG_DEBUG);
  }
}