I've been doing some hand fiddling with the Drupal comments file recently and have needed to rebuild the statistics and the tread field in the comments table. Where there are many scripts I've found to rebuild comment_statistics, there's little out there on rebuilding the comment thread field (which at first looks like a little black magic). I've built a script which walks all nodes and rebuilds both. (Parts of the script are mine, parts are lifted out of comments.module parts are bits of code I've found on drupal.org). I figured I'd post the code for it here (it's also the baseline for some code I'm going to post later in the week).
To be honest, I've lost track which lines are owned by which programmer, but all of it is either from the comments module or code I pulled from the drupal forum (If I find that post I'll credit it here). I'll also post the code over on drupal.org.
Sean Reiser, 40, is a developer, technologist, and amateur photographer. Sean has spent the past 20 years as a programmer, system architect and development manager. He is a life long New York resident.
Sean currently serves as the President and Chief Geek Officer of Repair Sense, Inc.. Please go to that site with any professional inquiries.
Sean can be found using a number of social networks. These are the ones he's most active on: