function ape_drupal_goto_alter in Advanced Page Expiration 7
Implements hook_drupal_goto_alter().
If a drupal_goto is called, detect if it is a 301 or 302 and set the cache-control header appropriately based on configured options.
This hook is used so we know the response code without having to use PHP 5.4.
File
- ./
ape.module, line 69 - Allows finer control of the Cache Control header.
Code
function ape_drupal_goto_alter(&$path, &$options, &$http_response_code) {
$max_age = NULL;
if ($http_response_code == 301) {
$max_age = variable_get('ape_301_lifetime', 0);
}
elseif ($http_response_code == 302) {
$max_age = variable_get('ape_302_lifetime', 0);
}
ape_cache_set($max_age);
ape_set_cache_header($max_age);
}