? .DS_Store
? sites/all/modules/devel
? sites/default/files
? sites/default/settings.php
Index: modules/comment/comment.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v
retrieving revision 1.894
diff -u -p -r1.894 comment.module
--- modules/comment/comment.module	5 Sep 2010 02:21:38 -0000	1.894
+++ modules/comment/comment.module	6 Sep 2010 22:18:35 -0000
@@ -1274,6 +1274,24 @@ function comment_node_delete($node) {
 }
 
 /**
+ * Implements hook_node_update().
+ */
+function comment_node_update($node) {
+  $stats = db_query('SELECT last_comment_uid, comment_count FROM {node_comment_statistics} WHERE nid = :nid', array(':nid' => $node->nid))->fetchObject();
+
+  if ($stats->comment_count == 0 && $stats->last_comment_uid != $node->uid) {
+    // Update the last_comment_uid field because the author of $node has been
+    // changed and there are no comments yet.
+    db_update('node_comment_statistics')
+      ->fields(array(
+        'last_comment_uid' => $node->uid,
+      ))
+      ->condition('nid', $node->nid)
+      ->execute();
+  }
+}
+
+/**
  * Implements hook_node_update_index().
  */
 function comment_node_update_index($node) {
