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();
  }
CommentFileSizeAuthor
path_redirect.clear_cache.patch511 bytesjoe-b
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

revnoah’s picture

I have a related issue. Subscribing.

revnoah’s picture

Issue summary: View changes

reformatting the code segments