From d61e7a663ed78f7ed27ea9c6819df7160e07e654 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sat, 11 Dec 2004 11:41:17 +0000 Subject: [PATCH] - Bugfix: make sure to update the node_comment_statistics table when a node is updated. --- modules/comment.module | 5 ++++- modules/comment/comment.module | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/modules/comment.module b/modules/comment.module index b2c523ccdc2..72f954b45f5 100644 --- a/modules/comment.module +++ b/modules/comment.module @@ -252,7 +252,10 @@ function comment_nodeapi(&$node, $op, $arg = 0) { } break; case 'insert': - db_query('INSERT INTO {node_comment_statistics} (nid, cid, last_comment_timestamp, last_comment_name, last_comment_uid, comment_count) VALUES (%d,0,%d,NULL,%d,0)', $node->nid, $node->created, $node->uid); + db_query('INSERT INTO {node_comment_statistics} (nid, cid, last_comment_timestamp, last_comment_name, last_comment_uid, comment_count) VALUES (%d, 0, %d, NULL, %d, 0)', $node->nid, $node->created, $node->uid); + break; + case 'update': + db_queryd('UPDATE {node_comment_statistics} SET last_comment_timestamp = %d WHERE nid = %d AND cid = 0', $node->changed, $node->nid); break; case 'delete': db_query('DELETE FROM {comments} WHERE nid = %d', $node->nid); diff --git a/modules/comment/comment.module b/modules/comment/comment.module index b2c523ccdc2..72f954b45f5 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -252,7 +252,10 @@ function comment_nodeapi(&$node, $op, $arg = 0) { } break; case 'insert': - db_query('INSERT INTO {node_comment_statistics} (nid, cid, last_comment_timestamp, last_comment_name, last_comment_uid, comment_count) VALUES (%d,0,%d,NULL,%d,0)', $node->nid, $node->created, $node->uid); + db_query('INSERT INTO {node_comment_statistics} (nid, cid, last_comment_timestamp, last_comment_name, last_comment_uid, comment_count) VALUES (%d, 0, %d, NULL, %d, 0)', $node->nid, $node->created, $node->uid); + break; + case 'update': + db_queryd('UPDATE {node_comment_statistics} SET last_comment_timestamp = %d WHERE nid = %d AND cid = 0', $node->changed, $node->nid); break; case 'delete': db_query('DELETE FROM {comments} WHERE nid = %d', $node->nid);