Ticket #11399: cpc.patch
| File cpc.patch, 1.6 KB (added by , 16 years ago) |
|---|
-
post.php
3924 3924 * 3925 3925 * @uses do_action() Calls 'clean_post_cache' on $id before adding children (if any). 3926 3926 * 3927 * @param int $id The Post ID in the cache to clean 3927 * @param int $id Optional The Post ID in the cache to clean 3928 * @param array $found A list of nodes that have already been found 3928 3929 */ 3929 function clean_post_cache($id ) {3930 function clean_post_cache($id,$found=null) { 3930 3931 global $_wp_suspend_cache_invalidation, $wpdb; 3931 3932 3932 3933 if ( !empty($_wp_suspend_cache_invalidation) ) 3933 3934 return; 3934 3935 3936 if ( $found == null ) 3937 $found = array(); 3938 3935 3939 $id = (int) $id; 3936 3940 3937 wp_cache_delete($id, 'posts');3938 wp_cache_delete($id, 'post_meta');3941 if ( array_key_exists($id,$found) ) 3942 return; 3939 3943 3940 clean_object_term_cache($id, 'post');3944 $found[$id] = true; 3941 3945 3942 wp_cache_delete( 'wp_get_archives', 'general' );3943 3944 do_action('clean_post_cache', $id);3945 3946 3946 if ( $children = $wpdb->get_col( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_parent = %d", $id) ) ) { 3947 3947 foreach( $children as $cid ) 3948 3948 clean_post_cache( $cid ); 3949 3949 } 3950 3950 3951 if ( is_multisite() ) 3952 wp_cache_delete( $wpdb->blogid . '-' . $id, 'global-posts' ); 3951 foreach ( $found as $id => $val ) 3952 { 3953 wp_cache_delete($id, 'posts'); 3954 wp_cache_delete($id, 'post_meta'); 3955 3956 clean_object_term_cache($id, 'post'); 3957 3958 wp_cache_delete( 'wp_get_archives', 'general' ); 3959 3960 do_action('clean_post_cache', $id); 3961 3962 if ( is_multisite() ) 3963 wp_cache_delete( $wpdb->blogid . '-' . $id, 'global-posts' ); 3964 } 3953 3965 } 3954 3966 3955 3967 /**