http://api.drupal.org/api/function/comment_enable/7 adds entries into {node_comment_statistics} for nodes that have no entry. The timestamp of the last comment is set to be n.changed, where it should be n.created.

The n.changed was probably copied over from http://api.drupal.org/api/function/comment_nodeapi/6 (see case when $op is 'insert'), though of course on node creation n.changed is just the creation date/time.

Also note the following comment in http://api.drupal.org/api/function/_comment_update_node_statistics/7:

last_comment_timestamp: the timestamp of the last comment for this node or the node create stamp if no comments exist for the node

I hit this in 5.22 but the problem is clearly still there in 6.x and 7.x.

Related:
#580638: {node_comment_statistics} not updated with altered author
#102766: Tracker displays "0" and incorrect last update for nodes if comments are made but comment module is disabled
#87590: Tracker is not comment.module-proof
and see also page "How to rebuild node_comment_statistics" http://drupal.org/node/137458

Files: 
CommentFileSizeAuthor
#3 last_comment_timestamp.patch625 bytesgpk
PASSED: [[SimpleTest]]: [MySQL] 18,734 pass(es).
[ View ]
#1 last_comment_timestamp.patch593 bytesgpk
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch last_comment_timestamp_0.patch.
[ View ]

Comments

Status:Active» Needs review
StatusFileSize
new593 bytes
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch last_comment_timestamp_0.patch.
[ View ]

Completely untested patch.

Might also want an update routine to correct existing timestamps (because for example if comment.module is first enabled part-way through the life of a site when there is existing content then those existing nodes will have the last_comment_timestamp set to their changed timestamp but new nodes will have it set to their created timestamp. This can make the tracker listing appear pretty random, especially any of the original nodes that still have no comments are updated - their last_comment_timestamp will then be the timestamp of the latest revision before comment.module was enabled).

Status:Needs review» Needs work

The last submitted patch, last_comment_timestamp.patch, failed testing.

Status:Needs work» Needs review
StatusFileSize
new625 bytes
PASSED: [[SimpleTest]]: [MySQL] 18,734 pass(es).
[ View ]

Try again with right patch format this time hopefully.

Status:Needs review» Reviewed & tested by the community

Status:Reviewed & tested by the community» Fixed

Committed to CVS HEAD. Thanks.

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Version:7.x-dev» 6.x-dev
Status:Closed (fixed)» Patch (to be ported)

Could do with backport to 6.x and 5.x.

And probably also an update routine to ensure consistency of last_comment_timestamp (which could currently be a mixture of n.created and c.changed) for nodes with 0 comments. However my SQL is not good enough to make a core-worthy patch for that..!