I have upgraded 4.4.2 to 4.5 successfully, but have noticed that the number of comments for each node is not showing up in the node links on the front page. If a new comment is added, however, the problem disappears for that node - the correct number of comments, including the added one, is shown in the node links. The problem is the same whatever theme is used. How can I fix this?

Comments

dries’s picture

Sounds like your node_comment_statistics table is not populated, presumably because update_105 (database/updates.inc) failed. I'd rollback my database and run the upgrade script again to inspect that further.

azium’s picture

Have just, in the last hour, upgraded to 4.5, and have the same problem. I didn't get any errors when I ran updates.php, so assumed this had run everyhing correctly? Everything else appears to be ok though. Is there some way to re-run update 105 on its own?

tony
--
http://azium.com

kps’s picture

You're not the only one; there has been a critical bug on this since before the release.

On that thread I offer a workaround (a script updatecommentcount.php) that might be better than nothing.

(I might be missing something, but it looks to me as though update 105 doesn't even try to initialize the table for any nodes other than forum nodes.)

junyor’s picture

The update won't correctly populate the table. Here's (part of) update_105:

"INSERT INTO {node_comment_statistics} (nid, cid, last_comment_timestamp, last_comment_name, last_comment_uid, comment_count) SELECT n.nid, 0, n.created, NULL, n.uid, 0 FROM {node} n"

So, it's setting the comment_timestamp = node creation time, forgetting the comment_creator, using the userid that created the node as the last_comment_uid, and setting the comment count to 0.

update_105 needs to be redone and I'd recommend a new update be created for 4.5.1 that will correctly initialize the node_comment_statistics table.

Adding comments to http://drupal.org/node/11366.