Make WordPress Core


Ignore:
Timestamp:
03/19/2017 04:21:38 PM (8 years ago)
Author:
flixos90
Message:

Multisite: Handle sites cache invalidation more granularly for option updates.

Previously update_blog_option() would trigger an invalidation of that site's entire cache although these changes did not affect the content of these caches. Furthermore changes to the special options blogname, siteurl and post_count should not invalidate the entire cache of that site, but only their respective site details cache. The option home now has the same behavior as it also belongs to the site details, but did not invalidate the cache at all previously.

Several new unit tests confirm these changes work as expected.

Fixes #40063.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/ms-default-filters.php

    r34251 r40305  
    8585remove_filter( 'option_home',    '_config_wp_home'    );
    8686
    87 // Some options changes should trigger blog details refresh.
    88 add_action( 'update_option_blogname',   'refresh_blog_details', 10, 0 );
    89 add_action( 'update_option_siteurl',    'refresh_blog_details', 10, 0 );
    90 add_action( 'update_option_post_count', 'refresh_blog_details', 10, 0 );
     87// Some options changes should trigger site details refresh.
     88add_action( 'update_option_blogname',   '_clean_site_details_cache', 10, 0 );
     89add_action( 'update_option_siteurl',    '_clean_site_details_cache', 10, 0 );
     90add_action( 'update_option_post_count', '_clean_site_details_cache', 10, 0 );
     91add_action( 'update_option_home',       '_clean_site_details_cache', 10, 0 );
    9192
    9293// If the network upgrade hasn't run yet, assume ms-files.php rewriting is used.
Note: See TracChangeset for help on using the changeset viewer.