Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I've had a problem with cache_page being cleared every time a node edit page is loaded, regardless wether it is saved or not. Tracked it down to pathauto.module _pathauto_alias_exists(), which is called when a node edit form is loaded, calling path_redirect_delete_multiple() if the path_redirect.module exists.
function path_redirect_delete_multiple($rids = NULL, $conditions = array()) {
$query = array();
_path_redirect_build_conditions($query, $rids, $conditions);
$sql = 'DELETE FROM {path_redirect} WHERE ' . implode(' AND ', $query['conditions']);
db_query($sql, $query['args']);
$deleted = db_affected_rows();
path_redirect_clear_cache();
return $deleted;
}
In the function as it stands, path_redirect_clear_cache() is called whether or not anything is deleted. I wonder whether a simple condition could be added to only clear the cache if $deleted is non-zero?
$deleted = db_affected_rows();
if ($deleted) {
path_redirect_clear_cache();
}
Comment | File | Size | Author |
---|---|---|---|
path_redirect.clear_cache.patch | 511 bytes | joe-b |
Comments
Comment #1
revnoah CreditAttribution: revnoah commentedI have a related issue. Subscribing.
Comment #1.0
revnoah CreditAttribution: revnoah commentedreformatting the code segments