Changeset 2976 for trunk/wp-includes/functions.php
- Timestamp:
- 10/29/2005 11:23:17 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/functions.php
r2968 r2976 1276 1276 // Get the categories for all the posts 1277 1277 for ($i = 0; $i < count($posts); $i++) { 1278 $post_id_ list[] = $posts[$i]->ID;1278 $post_id_array[] = $posts[$i]->ID; 1279 1279 $post_cache[$posts[$i]->ID] = &$posts[$i]; 1280 1280 } 1281 1281 1282 $post_id_list = implode(',', $post_id_ list);1282 $post_id_list = implode(',', $post_id_array); 1283 1283 1284 1284 update_post_category_cache($post_id_list); 1285 1285 1286 1286 // Do the same for comment numbers 1287 $comment_counts = $wpdb->get_results("SELECT ID, COUNT( comment_ID ) AS ccount1288 FROM $wpdb-> posts1289 LEFT JOIN $wpdb->comments ON ( comment_post_ID = ID AND comment_approved = '1')1290 WHERE ID IN ($post_id_list)1291 GROUP BY ID");1287 $comment_counts = $wpdb->get_results("SELECT comment_post_ID, COUNT( comment_ID ) AS ccount 1288 FROM $wpdb->comments 1289 WHERE comment_post_ID IN ($post_id_list) 1290 AND comment_approved = '1' 1291 GROUP BY comment_post_ID"); 1292 1292 1293 1293 if ( $comment_counts ) { 1294 foreach ($comment_counts as $comment_count) 1295 $comment_count_cache["$comment_count->ID"] = $comment_count->ccount; 1294 foreach ($comment_counts as $comment_count) { 1295 $comment_count_cache["$comment_count->comment_post_ID"] = $comment_count->ccount; 1296 $got_count[] = $comment_count->comment_post_ID; 1297 } 1298 foreach ( $post_id_array as $id ) 1299 if ( !in_array( $id, $got_count ) ) 1300 $comment_count_cache["$id"] = 0; 1296 1301 } 1297 1302
Note: See TracChangeset
for help on using the changeset viewer.