Kill old paths from cache if a 301 was given
| Project: | Boost |
| Version: | 6.x-1.x-dev |
| Component: | Expiration logic |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
If the path of a node has changed & "Do not flush expired content on cron run, instead re-crawl and overwrite it" is set and the old path gives a 301 due to Path Redirect then the old path will still give a 200 instead of a 301. There are several ways to fix the issue.
* Put a fix in boost_exit so any call to drupal_goto flushes the cache. Because hook_exit does not give me the redirect code I need to recreate the conditions that created the redirect via code from path_redirect_init() & globalredirect_init(). Other option is to assume if the code doesn't have destination=X then it was created by a module.
* Flush the file, then crawl the url, from inside the crawler.
* Detect path changes and kill the old file from boost_nodeapi

#1
This detects path changes... I should add it in. Runs under
case 'presave':in nodeapi.<?php/**
* Implementation of hook_node_presave().
*
* Creates automatic redirects when URL aliases are manually changed.
*/
function path_redirect_node_presave($node) {
if (path_redirect_var('auto_redirect') && !empty($node->path)) {
$node_path = 'node/'. $node->nid;
$old_alias = drupal_get_path_alias($node_path, ($node->language ? $node->language : ''));
if ($old_alias != $node_path && $node->path != $old_alias) {
// If the user is manually changing the path alias, add a redirect from the old alias to the node.
path_redirect_save(array('path' => $old_alias, 'redirect' => $node_path));
}
}
}
?>
#2
This does #1 & #3 from the original post
#3
Does all 3. Will commit soon to make the 4pm dev build time.
#4
committed
#5
Automatically closed -- issue fixed for 2 weeks with no activity.