Changeset 4631
- Timestamp:
- 12/08/2006 07:35:45 AM (18 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-db.php
r4534 r4631 134 134 } 135 135 136 wp_cache_delete($cat_ID, 'category'); 137 wp_cache_delete('get_categories', 'category'); 136 clean_category_cache($cat_ID); 138 137 139 138 if ($update) { 140 139 do_action('edit_category', $cat_ID); 141 140 } else { 142 wp_cache_delete('all_category_ids', 'category');143 141 do_action('create_category', $cat_ID); 144 142 do_action('add_category', $cat_ID); … … 214 212 } 215 213 216 wp_cache_delete($cat_ID, 'category'); 217 wp_cache_delete('all_category_ids', 'category'); 218 wp_cache_delete('get_categories', 'category'); 214 clean_category_cache($cat_ID); 219 215 220 216 do_action('delete_category', $cat_ID); … … 488 484 } 489 485 490 do_action('edit_link', $link_ID);491 486 } // wp_set_link_cats() 492 487 -
trunk/wp-includes/comment.php
r4626 r4631 431 431 } 432 432 433 if ( $wpdb->query($query) ) { 434 do_action('wp_set_comment_status', $comment_id, $comment_status); 435 436 $comment = get_comment($comment_id); 437 $comment_post_ID = $comment->comment_post_ID; 438 $c = $wpdb->get_row("SELECT count(*) as c FROM {$wpdb->comments} WHERE comment_post_ID = '$comment_post_ID' AND comment_approved = '1'"); 439 if ( is_object($c) ) 440 $wpdb->query("UPDATE $wpdb->posts SET comment_count = '$c->c' WHERE ID = '$comment_post_ID'"); 441 return true; 442 } else { 433 if ( !$wpdb->query($query) ) 443 434 return false; 444 } 435 436 do_action('wp_set_comment_status', $comment_id, $comment_status); 437 $comment = get_comment($comment_id); 438 wp_update_comment_count($comment->comment_post_ID); 439 return true; 445 440 } 446 441 … … 491 486 $wpdb->query("UPDATE $wpdb->posts SET comment_count = $count WHERE ID = '$post_id'"); 492 487 $comment_count_cache[$post_id] = $count; 488 489 $post = get_post($post_id); 490 if ( 'page' == $post->post_type ) 491 clean_page_cache( $post_id ); 492 else 493 clean_post_cache( $post_id ); 494 495 do_action('edit_post', $post_id); 496 493 497 return true; 494 498 } -
trunk/wp-includes/functions.php
r4628 r4631 520 520 521 521 function clean_post_cache($id) { 522 global $post_cache, $ blog_id;522 global $post_cache, $post_meta_cache, $category_cache, $blog_id; 523 523 524 524 if ( isset( $post_cache[$blog_id][$id] ) ) 525 525 unset( $post_cache[$blog_id][$id] ); 526 527 if ( isset ($post_meta_cache[$blog_id][$id] ) ) 528 unset( $post_meta_cache[$blog_id][$id] ); 529 530 if ( isset( $category_cache[$blog_id][$id]) ) 531 unset ( $category_cache[$blog_id][$id] ); 526 532 } 527 533 … … 538 544 } 539 545 540 541 546 function clean_page_cache($id) { 542 547 global $page_cache, $blog_id; … … 544 549 if ( isset( $page_cache[$blog_id][$id] ) ) 545 550 unset( $page_cache[$blog_id][$id] ); 551 552 wp_cache_delete($id, 'pages'); 553 wp_cache_delete( 'all_page_ids', 'pages' ); 554 wp_cache_delete( 'get_pages', 'page' ); 546 555 } 547 556 … … 648 657 function update_category_cache() { 649 658 return true; 659 } 660 661 function clean_category_cache($id) { 662 wp_cache_delete($id, 'category'); 663 wp_cache_delete('all_category_ids', 'category'); 664 wp_cache_delete('get_categories', 'category'); 650 665 } 651 666 -
trunk/wp-includes/post.php
r4625 r4631 439 439 440 440 if ( 'page' == $post->post_type ) { 441 wp_cache_delete( 'all_page_ids', 'pages' ); 442 wp_cache_delete( 'get_pages', 'page' ); 441 clean_page_cache($postid); 443 442 $wp_rewrite->flush_rules(); 444 443 } … … 651 650 if ( 'page' == $post_type ) { 652 651 clean_page_cache($post_ID); 653 wp_cache_delete($post_ID, 'pages');652 $wp_rewrite->flush_rules(); 654 653 } else { 655 654 clean_post_cache($post_ID); … … 690 689 } 691 690 } else if ($post_type == 'page') { 692 wp_cache_delete( 'all_page_ids', 'pages' );693 wp_cache_delete( 'get_pages', 'page' );694 $wp_rewrite->flush_rules();695 696 691 if ( !empty($page_template) ) 697 692 if ( ! update_post_meta($post_ID, '_wp_page_template', $page_template)) … … 817 812 $count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->post2cat, $wpdb->posts WHERE $wpdb->posts.ID=$wpdb->post2cat.post_id AND post_status = 'publish' AND post_type = 'post' AND category_id = '$cat_id'"); 818 813 $wpdb->query("UPDATE $wpdb->categories SET category_count = '$count' WHERE cat_ID = '$cat_id'"); 819 wp_cache_delete($cat_id, 'category');814 clean_category_cache($cat_id); 820 815 do_action('edit_category', $cat_id); 821 816 } 822 823 wp_cache_delete('get_categories', 'category');824 825 do_action('edit_post', $post_ID);826 817 } // wp_set_post_categories() 827 818
Note: See TracChangeset
for help on using the changeset viewer.