Changeset 20569
- Timestamp:
- 04/23/2012 10:04:35 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/class-wp-posts-list-table.php
r20423 r20569 361 361 $page->post_parent = 0; 362 362 $wpdb->update( $wpdb->posts, array( 'post_parent' => 0 ), array( 'ID' => $page->ID ) ); 363 clean_post_cache( $page ->ID, $page->post_type);363 clean_post_cache( $page ); 364 364 } 365 365 -
trunk/wp-includes/comment.php
r20435 r20569 1580 1580 $wpdb->update( $wpdb->posts, array('comment_count' => $new), array('ID' => $post_id) ); 1581 1581 1582 clean_post_cache( $post _id, $post->post_type);1582 clean_post_cache( $post ); 1583 1583 1584 1584 do_action('wp_update_comment_count', $post_id, $new, $old); -
trunk/wp-includes/deprecated.php
r20423 r20569 3151 3151 _deprecated_function( __FUNCTION__, 3.4, 'clean_post_cache()' ); 3152 3152 3153 clean_post_cache( $id , 'page');3154 } 3153 clean_post_cache( $id ); 3154 } -
trunk/wp-includes/post.php
r20465 r20569 1362 1362 $return = $wpdb->update( $wpdb->posts, array('post_type' => $post_type), array('ID' => $post_id) ); 1363 1363 1364 clean_post_cache( $post_id , $post_type);1364 clean_post_cache( $post_id ); 1365 1365 1366 1366 return $return; … … 2046 2046 do_action( 'deleted_post', $postid ); 2047 2047 2048 clean_post_cache( $post id, $post->post_type);2048 clean_post_cache( $post ); 2049 2049 2050 2050 if ( is_post_type_hierarchical( $post->post_type ) ) { 2051 2051 foreach ( (array) $children as $child ) 2052 clean_post_cache( $child ->ID, $child->post_type);2052 clean_post_cache( $child ); 2053 2053 } 2054 2054 … … 2629 2629 $current_guid = get_post_field( 'guid', $post_ID ); 2630 2630 2631 clean_post_cache( $post_ID , $data['post_type']);2631 clean_post_cache( $post_ID ); 2632 2632 2633 2633 // Set GUID … … 3734 3734 update_attached_file( $post_ID, $file ); 3735 3735 3736 clean_post_cache( $post_ID , $post_type);3736 clean_post_cache( $post_ID ); 3737 3737 3738 3738 if ( ! empty( $context ) ) … … 3839 3839 @ unlink($file); 3840 3840 3841 clean_post_cache( $post _id, $post->post_type);3841 clean_post_cache( $post ); 3842 3842 3843 3843 return $post; … … 4320 4320 * @uses do_action() Calls 'clean_post_cache' on $id before adding children (if any). 4321 4321 * 4322 * @param int $id The Post ID in the cache to clean 4323 * @param string $post_type The post_type of the post. Defaults to "post" 4324 */ 4325 function clean_post_cache($id, $post_type = 'post') { 4322 * @param object|int $post The post object or ID to remove from the cache 4323 */ 4324 function clean_post_cache( $post ) { 4326 4325 global $_wp_suspend_cache_invalidation, $wpdb; 4327 4326 … … 4329 4328 return; 4330 4329 4331 $id = (int) $id; 4332 4333 if ( 0 === $id ) 4330 $post = get_post( $post ); 4331 if ( empty( $post ) ) 4334 4332 return; 4335 4333 4336 wp_cache_delete( $id, 'posts');4337 wp_cache_delete( $id, 'post_meta');4338 4339 clean_object_term_cache( $ id, $post_type );4334 wp_cache_delete( $post->ID, 'posts' ); 4335 wp_cache_delete( $post->ID, 'post_meta' ); 4336 4337 clean_object_term_cache( $post->ID, $post->post_type ); 4340 4338 4341 4339 wp_cache_delete( 'wp_get_archives', 'general' ); 4342 4340 4343 do_action( 'clean_post_cache', $ id, $post_type);4344 4345 if ( 'page' == $post _type ) {4341 do_action( 'clean_post_cache', $post->ID, $post ); 4342 4343 if ( 'page' == $post->post_type ) { 4346 4344 wp_cache_delete( 'all_page_ids', 'posts' ); 4347 4345 wp_cache_delete( 'get_pages', 'posts' ); 4348 do_action( 'clean_page_cache', $ id);4349 } 4350 4351 if ( $children = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_type FROM $wpdb->posts WHERE post_parent = %d", $ id) ) ) {4352 foreach ( $children as $c id ) {4346 do_action( 'clean_page_cache', $post->ID ); 4347 } 4348 4349 if ( $children = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_type FROM $wpdb->posts WHERE post_parent = %d", $post->ID) ) ) { 4350 foreach ( $children as $child ) { 4353 4351 // Loop detection 4354 if ( $c id->ID == $id)4352 if ( $child->ID == $post->ID ) 4355 4353 continue; 4356 clean_post_cache( $c id->ID, $cid->post_type);4354 clean_post_cache( $child ); 4357 4355 } 4358 4356 } 4359 4357 4360 4358 if ( is_multisite() ) 4361 wp_cache_delete( $wpdb->blogid . '-' . $ id, 'global-posts' );4359 wp_cache_delete( $wpdb->blogid . '-' . $post->ID, 'global-posts' ); 4362 4360 } 4363 4361 … … 4564 4562 * @param object $post Object type containing the post information 4565 4563 */ 4566 function _save_post_hook( $post_id, $post) {4567 clean_post_cache( $post_id, $post->post_type);4564 function _save_post_hook( $post_id, $post ) { 4565 clean_post_cache( $post ); 4568 4566 } 4569 4567
Note: See TracChangeset
for help on using the changeset viewer.