Index: includes/bootstrap.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v retrieving revision 1.192 diff -u -p -r1.192 bootstrap.inc --- includes/bootstrap.inc 10 Sep 2007 12:19:11 -0000 1.192 +++ includes/bootstrap.inc 14 Sep 2007 00:57:04 -0000 @@ -567,7 +567,7 @@ function drupal_load($type, $name) { */ function drupal_page_header() { header("Expires: Sun, 19 Nov 1978 05:00:00 GMT"); - header("Last-Modified: ". gmdate("D, d M Y H:i:s") ." GMT"); + header("Last-Modified: ". gmdate("D, d M Y H:i:s", drupal_get_cache_date()) ." GMT"); header("Cache-Control: store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", FALSE); } @@ -583,7 +583,7 @@ function drupal_page_header() { */ function drupal_page_cache_header($cache) { // Set default values: - $last_modified = gmdate('D, d M Y H:i:s', $cache->created) .' GMT'; + $last_modified = gmdate('D, d M Y H:i:s', $cache->timestamp) .' GMT'; $etag = '"'. md5($last_modified) .'"'; // See if the client has provided the required HTTP headers: @@ -628,6 +628,42 @@ function drupal_page_cache_header($cache } /** + * Set a page's age + * + * Call this function if you want to set the timestamp of a pages age. + * + * @param $date a timestamp + * + * @return the highest timestamp passed into this function so far. + */ +function drupal_set_cache_date($date = 0) { + static $cache_date = 0; + + if ($date > $cache_date) { + $cache_date = $date; + } + + return $cache_date; +} + +/** + * Get cache date + * + * @return the highest timestamp passed into drupal_set_cache_date so far or the current time. + */ +function drupal_get_cache_date() { + $date = drupal_set_cache_date(); + $time = time(); + + if ($date < $time && $date > 0) { + return $date; + } + else { + return $time; + } +} + +/** * Define the critical hooks that force modules to always be loaded. */ function bootstrap_hooks() { Index: includes/cache.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/cache.inc,v retrieving revision 1.14 diff -u -p -r1.14 cache.inc --- includes/cache.inc 26 Aug 2007 09:33:49 -0000 1.14 +++ includes/cache.inc 14 Sep 2007 00:57:04 -0000 @@ -22,7 +22,7 @@ function cache_get($cid, $table = 'cache variable_set('cache_flush', 0); } - $cache = db_fetch_object(db_query("SELECT data, created, headers, expire, serialized FROM {". $table ."} WHERE cid = '%s'", $cid)); + $cache = db_fetch_object(db_query("SELECT data, created, timestamp, headers, expire, serialized FROM {". $table ."} WHERE cid = '%s'", $cid)); if (isset($cache->data)) { // If the data is permanent or we're not enforcing a minimum cache lifetime // always return the cached data. @@ -105,9 +105,9 @@ function cache_set($cid, $data, $table = $serialized = 1; } $created = time(); - db_query("UPDATE {". $table ."} SET data = %b, created = %d, expire = %d, headers = '%s', serialized = %d WHERE cid = '%s'", $data, $created, $expire, $headers, $serialized, $cid); + db_query("UPDATE {". $table ."} SET data = %b, created = %d, timestamp = %d, expire = %d, headers = '%s', serialized = %d WHERE cid = '%s'", $data, $created, drupal_get_cache_date(), $expire, $headers, $serialized, $cid); if (!db_affected_rows()) { - @db_query("INSERT INTO {". $table ."} (cid, data, created, expire, headers, serialized) VALUES ('%s', %b, %d, %d, '%s', %d)", $cid, $data, $created, $expire, $headers, $serialized); + @db_query("INSERT INTO {". $table ."} (cid, data, created, timestamp, expire, headers, serialized) VALUES ('%s', %b, %d, %d, '%s', %d)", $cid, $data, $created, drupal_get_cache_date(), $expire, $headers, $serialized); } } cvs diff: Diffing misc cvs diff: Diffing misc/farbtastic cvs diff: Diffing modules cvs diff: Diffing modules/aggregator cvs diff: Diffing modules/block cvs diff: Diffing modules/blog cvs diff: Diffing modules/blogapi cvs diff: Diffing modules/book cvs diff: Diffing modules/color cvs diff: Diffing modules/color/images cvs diff: Diffing modules/comment Index: modules/comment/comment.module =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v retrieving revision 1.583 diff -u -p -r1.583 comment.module --- modules/comment/comment.module 11 Sep 2007 14:50:04 -0000 1.583 +++ modules/comment/comment.module 14 Sep 2007 00:57:05 -0000 @@ -495,6 +495,9 @@ function comment_form_alter(&$form, $for */ function comment_nodeapi(&$node, $op, $arg = 0) { switch ($op) { + case 'view': + drupal_set_cache_date($node->last_comment_timestamp); + break; case 'load': return db_fetch_array(db_query("SELECT last_comment_timestamp, last_comment_name, comment_count FROM {node_comment_statistics} WHERE nid = %d", $node->nid)); break; @@ -999,6 +1002,7 @@ function comment_render($node, $cid = 0) $mode = _comment_get_display_setting('mode'); $order = _comment_get_display_setting('sort'); $comments_per_page = _comment_get_display_setting('comments_per_page'); + $latest = 0; if ($cid && is_numeric($cid)) { // Single comment view. @@ -1016,6 +1020,7 @@ function comment_render($node, $cid = 0) $comment->name = $comment->uid ? $comment->registered_name : $comment->name; $links = module_invoke_all('link', 'comment', $comment, 1); drupal_alter('link', $links, $node); + $latest = ($comment->timestamp > $latest) ? $comment->timestamp : $latest; $output .= theme('comment_view', $comment, $node, $links); } @@ -1086,6 +1091,8 @@ function comment_render($node, $cid = 0) } } + $latest = ($comment->timestamp > $latest) ? $comment->timestamp : $latest; + if ($mode == COMMENT_MODE_FLAT_COLLAPSED) { $comments .= theme('comment_flat_collapsed', $comment, $node); } @@ -1123,6 +1130,8 @@ function comment_render($node, $cid = 0) } $output = theme('comment_wrapper', $output, $node); + + drupal_set_cache_date($latest); } return $output; @@ -1307,6 +1316,8 @@ function theme_comment_admin_overview($f $row[] = drupal_render($form['operations'][$key]); $rows[] = $row; } + + drupal_set_cache_date($latest); } else { $rows[] = array(array('data' => t('No comments available.'), 'colspan' => '6')); cvs diff: Diffing modules/contact cvs diff: Diffing modules/dblog cvs diff: Diffing modules/drupal cvs diff: Diffing modules/filter cvs diff: Diffing modules/forum cvs diff: Diffing modules/help cvs diff: Diffing modules/locale cvs diff: Diffing modules/menu cvs diff: Diffing modules/node Index: modules/node/node.module =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.module,v retrieving revision 1.881 diff -u -p -r1.881 node.module --- modules/node/node.module 11 Sep 2007 14:50:04 -0000 1.881 +++ modules/node/node.module 14 Sep 2007 00:57:06 -0000 @@ -943,6 +943,8 @@ function node_view($node, $teaser = FALS // Allow modules to modify the fully-built node. node_invoke_nodeapi($node, 'alter', $teaser, $page); + drupal_set_cache_date($node->changed); + return theme('node', $node, $teaser, $page); } @@ -991,6 +993,8 @@ function node_build_content($node, $teas $node->build_mode = NODE_BUILD_NORMAL; } + drupal_set_cache_date($node->changed); + // Remove the delimiter (if any) that separates the teaser from the body. $node->body = isset($node->body) ? str_replace('', '', $node->body) : ''; cvs diff: Diffing modules/openid cvs diff: Diffing modules/path cvs diff: Diffing modules/php cvs diff: Diffing modules/ping cvs diff: Diffing modules/poll cvs diff: Diffing modules/profile cvs diff: Diffing modules/search cvs diff: Diffing modules/statistics cvs diff: Diffing modules/syslog cvs diff: Diffing modules/system Index: modules/system/system.install =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.install,v retrieving revision 1.151 diff -u -p -r1.151 system.install --- modules/system/system.install 11 Sep 2007 19:14:34 -0000 1.151 +++ modules/system/system.install 14 Sep 2007 00:57:07 -0000 @@ -3766,6 +3766,15 @@ function system_update_6032() { } /** + * add timestamp cache to cache_page + */ +function system_update_6033() { + $ret = array(); + db_add_field($ret, 'cache_page', 'timestamp', array('type' => 'int', 'not null' => TRUE, 'default' => 0)); + return $ret; +} + +/** * @} End of "defgroup updates-5.x-to-6.x" * The next series of updates should start at 7000. */ Index: modules/system/system.schema =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.schema,v retrieving revision 1.13 diff -u -p -r1.13 system.schema --- modules/system/system.schema 11 Sep 2007 19:14:34 -0000 1.13 +++ modules/system/system.schema 14 Sep 2007 00:57:07 -0000 @@ -56,8 +56,9 @@ function system_schema() { ); $schema['cache_form'] = $schema['cache']; - $schema['cache_page'] = $schema['cache']; $schema['cache_menu'] = $schema['cache']; + $schema['cache_page'] = $schema['cache']; + $schema['cache_page']['fields'] = array('timestamp' => array('type' => 'int', 'not null' => TRUE, 'default' => 0)); $schema['files'] = array( 'fields' => array( cvs diff: Diffing modules/taxonomy cvs diff: Diffing modules/throttle cvs diff: Diffing modules/tracker Index: modules/tracker/tracker.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/tracker/tracker.pages.inc,v retrieving revision 1.2 diff -u -p -r1.2 tracker.pages.inc --- modules/tracker/tracker.pages.inc 2 Sep 2007 14:56:18 -0000 1.2 +++ modules/tracker/tracker.pages.inc 14 Sep 2007 00:57:07 -0000 @@ -48,6 +48,7 @@ function tracker_page($uid = 0) { $result = pager_query($sql, 25, 0, $sql_count); } + $latest = 0; $rows = array(); while ($node = db_fetch_object($result)) { // Determine the number of comments: @@ -68,12 +69,16 @@ function tracker_page($uid = 0) { array('class' => 'replies', 'data' => $comments), t('!time ago', array('!time' => format_interval(time() - $node->last_updated))) ); + + $latest = ($node->last_updated > $latest) ? $node->last_updated : $latest; } if (!$rows) { $rows[] = array(array('data' => t('No posts available.'), 'colspan' => '5')); } + drupal_set_cache_date($latest); + $header = array(t('Type'), t('Post'), t('Author'), t('Replies'), t('Last updated')); $output = '
';