function flush_page_cache_init in Flush page cache 6
Same name and namespace in other branches
- 7 flush_page_cache.module \flush_page_cache_init()
Implementation of hook_init().
Ideally we should be flushing the page's cache via hook_boot() but user_access() isn't available until hook_init().
File
- ./
flush_page_cache.module, line 73 - Easing the pain when you need to flush...Drupal's cache.
Code
function flush_page_cache_init() {
if (!flush_page_cache_requested()) {
return;
}
// Clear custom cache cid and tables based on drupal path.
$path = $_GET['q'];
$alias = drupal_get_path_alias($_GET['q']);
$custom = variable_get('flush_page_cache_custom', array(
array(
'*',
'variables',
'cache',
FALSE,
),
));
foreach ($custom as $item) {
if (drupal_match_path($path, $item[0]) || drupal_match_path($alias, $item[0])) {
cache_clear_all($item[1], $item[2], $item[3]);
}
}
}