function query_parameters_to_url_output_and_cache_redirect in Query Parameters To URL 7
Outputs the redirect, and caches the response.
1 call to query_parameters_to_url_output_and_cache_redirect()
- query_parameters_to_url_init in ./
query_parameters_to_url.module - Implements hook_init().
File
- ./
query_parameters_to_url.module, line 702 - Query Arguments To URL module.
Code
function query_parameters_to_url_output_and_cache_redirect($url) {
// If cache is disabled, just exit.
$cache_enabled = variable_get('cache', 0);
$is_cache_able = drupal_page_is_cacheable();
if (!$cache_enabled || !$is_cache_able) {
drupal_exit($url);
}
// Otherwise do the same things that drupal_exit does, and serve from
// cache.
if (drupal_get_bootstrap_phase() == DRUPAL_BOOTSTRAP_FULL) {
if (!defined('MAINTENANCE_MODE') || MAINTENANCE_MODE != 'update') {
module_invoke_all('exit', $url);
}
drupal_session_commit();
if ($cache_enabled) {
// We must output something to allow the request to be cached.
echo ' ';
$cache = drupal_page_set_cache();
if ($cache) {
// When caching this redirect for the first time we still need
// to ensure that the correct cache headers are sent.
// @see drupal_page_footer()
drupal_serve_page_from_cache($cache);
}
}
}
exit;
}