Commit 02305f18 authored by JonBob's avatar JonBob

#55146: Cache was not accounting correctly for revisions.

parent e14573e5
......@@ -177,3 +177,10 @@ function content_update_5() {
return $ret;
}
}
/**
* The cache for nodes has changed to account for revisions correctly.
*/
function content_update_6() {
return array(update_sql('DELETE FROM {cache}'));
}
......@@ -213,7 +213,7 @@ function content_access($op, $node) {
* cache the loaded object structure and invalidate it during the update process.
*/
function content_load($node) {
$cid = 'content:'. $node->nid;
$cid = 'content:'. $node->nid .':'. $node->vid;
if ($cached = cache_get($cid)) {
return unserialize($cached->data);
}
......@@ -288,7 +288,7 @@ function content_insert(&$node) {
*/
function content_update(&$node) {
_content_field_invoke('update', $node);
cache_clear_all('content:'. $node->nid);
cache_clear_all('content:'. $node->nid .':'. $node->vid);
}
/**
......@@ -308,6 +308,21 @@ function content_view(&$node, $teaser = FALSE, $page = FALSE) {
$node->readmore = ($node->body != $node->teaser);
}
/**
* Implementation of hook_nodeapi().
*
* When a revision is deleted, make sure the appropriate cache item is cleared.
*/
function content_nodeapi(&$node, $op, $teaser, $page) {
switch ($op) {
case 'delete revision':
if (in_array($node->type, array_keys(_content_types()))) {
cache_clear_all('content:'. $node->nid .':'. $node->vid);
}
break;
}
}
/**
* Implementation of hook_field(). Handles common field housekeeping.
*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment