Move to NearlyFreeSpeech nearly complete.
-
Comments:
- here.
Well, I’ve moved over from Blogsome to NearlyFreeSpeech.net It’s very cool, and looks to be pretty cheap. I might have a high bandwidth bill for the last two days as I had to keep uploading SQL dump files (much faster than editing using nano over ssh!). When I imported all of my comments, the posts weren’t updated with the number of comments they each had, so I needed to run the following PHP script:
1 <?php
2 require_once('admin.php');
3
4 echo "Approving comments...";
5
6 // Approve all comments
7
8 $wpdb->query("UPDATE $wpdb->comments SET comment_approved = '1'");
9
10 echo "Updating post counts...";
11
12 // Populate comment_count field of posts table
13
14 $comments = $wpdb->get_results( "SELECT comment_post_ID, COUNT(*) as c FROM $wpdb->comments WHERE comment_approved = '1' GROUP BY comment_post_ID" );
15
16 if( is_array( $comments ) ) {
17
18 foreach ($comments as $comment) {
19
20 $wpdb->query( "UPDATE $wpdb->posts SET comment_count = $comment->c WHERE ID = '$comment->comment_post_ID'" );
21
22 }
23
24 }
25
26 echo "Done.";
27
28 ?>