Commit a27a14e3 authored by bgm's avatar bgm

Issue 1370776 : in hook_init, make the easy checks first, then do the more extensive tests.

parent 6799a541
......@@ -154,18 +154,25 @@ function boost_menu() {
function boost_init() {
global $_boost;
$_boost = boost_transform_url();
$_boost = array();
// Make sure the page is/should be cached according to our current configuration.
// Start with the quick checks
if ( strpos($_SERVER['SCRIPT_FILENAME'], 'index.php') === FALSE
|| $_SERVER['SERVER_SOFTWARE'] === 'PHP CLI'
|| ($_SERVER['REQUEST_METHOD'] != 'GET' && $_SERVER['REQUEST_METHOD'] != 'HEAD')
|| isset($_GET['nocache'])
|| empty($_boost['menu_item']['status'])
|| $_boost['menu_item']['status'] != 200
|| variable_get('site_offline', 0)
) {
$_boost['cache_this'] = FALSE;
}
else {
// More advanced checks
$_boost = boost_transform_url();
if (empty($_boost['menu_item']['status']) || $_boost['menu_item']['status'] != 200) {
$_boost['cache_this'] = FALSE;
}
}
// Give modules a chance to alter the cookie handler callback used.
// hook_boost_cookie_handler_callback_alter
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment