diff -Naur modules/node/node.module modules/node/node.module --- modules/node/node.module 2007-09-29 19:41:28.000000000 -0400 +++ modules/node/node.module 2007-11-04 19:44:45.000000000 -0500 @@ -501,17 +501,31 @@ * A fully-populated node object. */ function node_load($param = array(), $revision = NULL, $reset = NULL) { + global $user; static $nodes = array(); if ($reset) { $nodes = array(); } - $cachable = ($revision == NULL); + $cache_id = 0; $arguments = array(); if (is_numeric($param)) { - if ($cachable && isset($nodes[$param])) { - return is_object($nodes[$param]) ? drupal_clone($nodes[$param]) : $nodes[$param]; + if (module_exists('advcache')) { + $cache_id = ($revision == NULL) ? $param. '::'. advcache_array2int($user->roles) : 0; + } + if ($cache_id > 0) { + if (isset($nodes[$param])) { + return is_object($nodes[$param]) ? drupal_clone($nodes[$param]) : $nodes[$param]; + } + if ($user->uid != 1) { + $cache = cache_get($cache_id, 'cache_node'); + if ($cache) { + $cache = unserialize($cache->data); + $nodes[$param] = is_object($cache) ? drupal_clone($cache) : $cache; + return $nodes[$param]; + } + } } $cond = 'n.nid = %d'; $arguments[] = $param; @@ -549,8 +563,13 @@ $node->$key = $value; } } - if ($cachable) { + if ($cache_id > 0) { $nodes[$node->nid] = is_object($node) ? drupal_clone($node) : $node; + if ($user->uid != 1) { + if (!in_array($node->type, variable_get('advcache_node_exclude_types', array('poll')))) { + cache_set($cache_id, 'cache_node', serialize($nodes[$node->nid])); + } + } } } @@ -1973,8 +1992,8 @@ if (isset($node->body) && count(explode(' ', $node->body)) < $type->min_word_count) { form_set_error('body', t('The body of your @type is too short. You need at least %words words.', array('%words' => $type->min_word_count, '@type' => $type->name))); } - - if (isset($node->nid) && (node_last_changed($node->nid) > $node->changed)) { + $changed = node_last_changed($node->nid); + if (isset($node->nid) && ($changed > $node->changed)) { form_set_error('changed', t('This content has been modified by another user, changes cannot be saved.')); }