[wp-trac] [WordPress Trac] #11744: the global-posts bucket potentially contains garbage

WordPress Trac wp-trac at lists.automattic.com
Wed Jan 6 14:55:48 UTC 2010

#11744: the global-posts bucket potentially contains garbage
 Reporter:  Denis-de-Bernardy  |       Owner:  ryan     
     Type:  defect (bug)       |      Status:  new      
 Priority:  normal             |   Milestone:  3.0      
Component:  Cache              |     Version:  3.0      
 Severity:  normal             |    Keywords:  has-patch
 the newly introduced get_blog_post() function potentially contains garbage
 and is insufficiently cleaned up. it uses the following logic:

 wp_cache_get("$blog_id-$post_id", "global-posts");
 if false then
   select post regardless of status (can be trashed, draft, pending...)
   wp_cache_add() the thing in memcache

 the issue is the cleanup:

 function clear_global_post_cache( $post_id ) {
         global $wpdb;

         wp_cache_delete( $wpdb->blogid . '-' . $post_id, 'global-posts' );
 add_action( 'publish_post', 'clear_global_post_cache' );
 add_action( 'delete_post', 'clear_global_post_cache' );

 if a published post gets turned back to pending status, for instance, the
 global-posts bucket will still contain the cached post. we should use the
 save_post hook instead.

Ticket URL: <http://core.trac.wordpress.org/ticket/11744>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software

More information about the wp-trac mailing list