Opened 3 years ago
Closed 3 years ago
#11744 closed defect (bug) (fixed)
the global-posts bucket potentially contains garbage
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 3.0 |
| Component: | Cache | Version: | 3.0 |
| Severity: | normal | Keywords: | has-patch multisite |
| Cc: |
Description
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.
Attachments (1)
Change History (3)
Note: See
TracTickets for help on using
tickets.

(In [12768]) Merge clear_global_post_cache() into clean_post_cache(). fixes #11744