function boost_cache_expire_derivative in Boost 6
Finds all possible paths/redirects/aliases given the root path.
Parameters
$paths: Array of current URLs
$both: Expire database & file
$force_flush: Override the settings and kill the file
4 calls to boost_cache_expire_derivative()
- boost_block_form_flush_submit in ./
boost.module - boost_expire_node in ./
boost.module - Expires a node from the cache; including related pages.
- boost_rules_action_clear_page in ./
boost.rules.inc - Clears a page from the Boost cache
- boost_user in ./
boost.module - Implementation of hook_user(). Acts on user account actions.
File
- ./
boost.module, line 3161 - Provides static file caching for Drupal text output. Pages, Feeds, ect...
Code
function boost_cache_expire_derivative($paths, $both = FALSE, $force_flush = FALSE, $debug = FALSE) {
global $base_path;
$expire = array();
if (empty($paths)) {
return FALSE;
}
foreach ($paths as $path) {
// Given path
$expire[] = $path;
// Add the empty front page path if this is the alias
if ($path == variable_get('site_frontpage', 'node')) {
$expire[] = '';
$expire[] = 'rss.xml';
}
// Special front page feed handling
if (BOOST_CACHE_XML && ($path == '' || $path == '<front>')) {
$expire[] = 'rss.xml';
}
// Path alias
$path_alias = url($path, array(
'absolute' => FALSE,
));
if ($base_path != '/') {
$path_alias = implode('/', array_diff_assoc(array_filter(explode('/', $path_alias)), array_filter(explode('/', $base_path))));
}
$expire[] = $path_alias;
// Path redirects
if (module_exists('path_redirect')) {
$path_redirects = boost_path_redirect_load(array(
'redirect' => $path,
));
if (isset($path_redirects)) {
foreach ($path_redirects as $path_redirect) {
$expire[] = $path_redirect['path'];
}
}
}
}
// Expire cached files
$counter = 0;
if (empty($expire)) {
return FALSE;
}
$expire = array_unique($expire);
if (!$debug) {
if (BOOST_NO_DATABASE) {
$counter += boost_cache_expire_by_filename($expire, TRUE, $force_flush);
}
elseif ($both) {
$counter += boost_cache_expire_by_db($expire);
$counter += boost_cache_expire_by_filename($expire, TRUE, $force_flush);
}
else {
$counter += boost_cache_expire_by_db($expire);
if ($counter == 0) {
// Database was a negative. Fallback: Look into flushing by filename
$counter += boost_cache_expire_by_filename($expire, TRUE, $force_flush);
}
}
return $counter;
}
else {
return array(
'in' => $expire,
'db' => boost_cache_expire_by_db($expire, TRUE),
'filename' => boost_cache_expire_by_filename($expire, TRUE, FALSE, TRUE),
);
}
}