Make WordPress Core

Opened 2 years ago

Last modified 21 months ago

#55454 new defect (bug)

clean_site_details_cache() doesn't clean all site caches

Reported by: dd32's profile dd32 Owned by:
Milestone: Awaiting Review Priority: low
Severity: minor Version: 4.7
Component: Networks and Sites Keywords:
Focuses: multisite Cc:

Description

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 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' );

Change History (1)

#1 @sabernhardt
21 months ago

#55455 was marked as a duplicate.

Note: See TracTickets for help on using tickets.