') {
$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 = expire_path_redirect_load(array('redirect' => $path));
if (isset($path_redirects)) {
foreach ($path_redirects as $path_redirect) {
$expire[] = $path_redirect['path'];
}
}
}
}
// Expire cached files
if (empty($expire)) {
return FALSE;
}
$expire = array_unique($expire);
watchdog('expire','' . print_r($expire, TRUE) . '
');
// hook_expire_cache
foreach (module_implements('expire_cache') as $module) {
module_invoke($module, 'expire_cache', $expire);
}
return count($expire);
}
/**
* Retrieve a specific URL redirect from the database.
* http://drupal.org/node/451790
*
* @param $where
* Array containing 'redirect' => $path
*/
function expire_path_redirect_load($where = array(), $args = array(), $sort = array()) {
$redirects = array();
if (is_numeric($where)) {
$where = array('rid' => $where);
}
foreach ($where as $key => $value) {
if (is_string($key)) {
$args[] = $value;
$where[$key] = $key .' = '. (is_numeric($value) ? '%d' : "'%s'");
}
}
if ($where && $args) {
$sql = "SELECT * FROM {path_redirect} WHERE ". implode(' AND ', $where);
if ($sort) {
$sql .= ' ORDER BY '. implode(' ,', $sort);
}
$result = db_query($sql, $args);
while ($redirect = db_fetch_array($result)) {
$redirects[] = $redirect;
}
return $redirects;
}
}