Make WordPress Core

Ticket #11399: 11399.diff

File 11399.diff, 1.8 KB (added by nacin, 12 years ago)

Removes ancestors cache, as posts cache is plenty. Removes cache invalidation for children, as ancestors are no longer cached against a post.

  • wp-includes/post.php

     
    557557
    558558        $post = get_post( $post );
    559559
    560         if ( ! $ancestors = wp_cache_get( $post->ID, 'post_ancestors' ) ) {
    561560                $ancestors = array();
    562561
    563562                if ( !empty( $post->post_parent ) && $post->ID != $post->post_parent ) {
     
    572571                        }
    573572                }
    574573
    575                 wp_cache_add( $post->ID, $ancestors, 'post_ancestors' );
    576         }
    577 
    578574        return $ancestors;
    579575}
    580576
     
    22182214
    22192215        clean_post_cache( $post );
    22202216
    2221         if ( is_post_type_hierarchical( $post->post_type ) ) {
    2222                 foreach ( (array) $children as $child )
     2217        if ( is_post_type_hierarchical( $post->post_type ) && $children ) {
     2218                foreach ( $children as $child )
    22232219                        clean_post_cache( $child );
    22242220        }
    22252221
     
    45004496                wp_cache_delete( 'all_page_ids', 'posts' );
    45014497                do_action( 'clean_page_cache', $post->ID );
    45024498        }
    4503 
    4504         if ( $children = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_type FROM $wpdb->posts WHERE post_parent = %d", $post->ID) ) ) {
    4505                 foreach ( $children as $child ) {
    4506                         // Loop detection
    4507                         if ( $child->ID == $post->ID )
    4508                                 continue;
    4509                         clean_post_cache( $child );
    4510                 }
    4511         }
    45124499}
    45134500
    45144501/**
  • wp-includes/load.php

     
    410410
    411411        if ( function_exists( 'wp_cache_add_global_groups' ) ) {
    412412                wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'user_meta', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss', 'global-posts' ) );
    413                 wp_cache_add_non_persistent_groups( array( 'comment', 'counts', 'plugins', 'post_ancestors' ) );
     413                wp_cache_add_non_persistent_groups( array( 'comment', 'counts', 'plugins' ) );
    414414        }
    415415}
    416416