Changeset 3091
- Timestamp:
- 11/15/05 16:31:24 (3 years ago)
- Files:
-
- trunk/wp-admin/upgrade-functions.php (modified) (2 diffs)
- trunk/wp-includes/functions-post.php (modified) (2 diffs)
- trunk/wp-includes/version.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wp-admin/upgrade-functions.php
r2966 r3091 31 31 } 32 32 33 if ( $wp_current_db_version < 2966)33 if ( $wp_current_db_version < 3091 ) 34 34 upgrade_160(); 35 35 … … 297 297 $categories = $wpdb->get_col("SELECT cat_ID FROM $wpdb->categories"); 298 298 foreach ( $categories as $cat_id ) { 299 $count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->post2cat WHEREcategory_id = '$cat_id'");299 $count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->post2cat, $wpdb->posts WHERE $wpdb->posts.ID=$wpdb->post2cat.post_id AND post_status='publish' AND category_id = '$cat_id'"); 300 300 $wpdb->query("UPDATE $wpdb->categories SET category_count = '$count' WHERE cat_ID = '$cat_id'"); 301 301 } trunk/wp-includes/functions-post.php
r3090 r3091 168 168 if ($post_status == 'publish') { 169 169 do_action('publish_post', $post_ID); 170 171 // Update category counts. 172 foreach ( $post_category as $cat_id ) { 173 $count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->post2cat, $wpdb->posts WHERE $wpdb->posts.ID=$wpdb->post2cat.post_id AND post_status='publish' AND category_id = '$cat_id'"); 174 $wpdb->query("UPDATE $wpdb->categories SET category_count = '$count' WHERE cat_ID = '$cat_id'"); 175 wp_cache_delete($cat_id, 'category'); 176 } 177 170 178 if ($post_pingback && !defined('WP_IMPORTING')) 171 179 $result = $wpdb->query(" … … 478 486 do_action('delete_post', $postid); 479 487 488 if ( 'publish' == $post->post_status) { 489 $categories = wp_get_post_cats('', $post->ID); 490 if( is_array( $categories ) ) { 491 foreach ( $categories as $cat_id ) { 492 $wpdb->query("UPDATE $wpdb->categories SET category_count = category_count - 1 WHERE cat_ID = '$cat_id'"); 493 wp_cache_delete($cat_id, 'category'); 494 } 495 } 496 } 497 480 498 if ( 'static' == $post->post_status ) 481 499 $wpdb->query("UPDATE $wpdb->posts SET post_parent = $post->post_parent WHERE post_parent = $postid AND post_status = 'static'"); trunk/wp-includes/version.php
r2966 r3091 4 4 5 5 $wp_version = '1.6-ALPHA-2-still-dont-use'; 6 $wp_db_version = 2966;6 $wp_db_version = 3091; 7 7 8 8 ?>
