[wp-trac] [WordPress Trac] #55455: clean_site_details_cache() doesn't clean all site caches

WordPress Trac noreply at wordpress.org
Thu Mar 24 03:43:10 UTC 2022


#55455: clean_site_details_cache() doesn't clean all site caches
--------------------------------+-----------------------------
 Reporter:  dd32                |      Owner:  (none)
     Type:  defect (bug)        |     Status:  new
 Priority:  low                 |  Milestone:  Awaiting Review
Component:  Networks and Sites  |    Version:  4.7
 Severity:  minor               |   Keywords:
  Focuses:  multisite           |
--------------------------------+-----------------------------
 clean_site_details_cache() clear's two caches:
 {{{
         wp_cache_delete( $site_id, 'site-details' );
         wp_cache_delete( $site_id, 'blog-details' );
 }}}

 https://github.com/WordPress/wordpress-
 develop/blob/0b800e21c311e302824e4a025946a6fdb4f6c794/src/wp-includes/ms-
 blogs.php#L322-L337

 But there's a third used within `get_blog_details()` that's closely
 related to those two caches:
 {{{
         if ( $get_all ) {
                 $details = wp_cache_get( $blog_id . 'short', 'blog-
 details' );
         } else {
                 $details = wp_cache_get( $blog_id, 'blog-details' );
 }}}

 One could argue that the `blog-details` caches are not related to the
 `site-details` caches, but one would expect that if it clears some of
 them, that it'll clear all of them.

 `clean_blog_cache()` is a
 [https://developer.wordpress.org/reference/functions/clean_blog_cache/
 much more comprehensive function] though:
 {{{
         wp_cache_delete( $blog_id, 'sites' );
         wp_cache_delete( $blog_id, 'site-details' );
         wp_cache_delete( $blog_id, 'blog-details' );
         wp_cache_delete( $blog_id . 'short', 'blog-details' );
         wp_cache_delete( $domain_path_key, 'blog-lookup' );
         wp_cache_delete( $domain_path_key, 'blog-id-cache' );
         wp_cache_delete( $blog_id, 'blog_meta' );
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/55455>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list