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
Comment | File | Size | Author |
---|---|---|---|
#3 | last_comment_timestamp.patch | 625 bytes | gpk |
#1 | last_comment_timestamp.patch | 593 bytes | gpk |
Comments
Comment #1
gpk CreditAttribution: gpk commentedCompletely 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).
Comment #3
gpk CreditAttribution: gpk commentedTry again with right patch format this time hopefully.
Comment #4
moshe weitzman CreditAttribution: moshe weitzman commentedComment #5
Dries CreditAttribution: Dries commentedCommitted to CVS HEAD. Thanks.
Comment #7
gpk CreditAttribution: gpk commentedCould 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..!