Changeset 40346
- Timestamp:
- 03/28/2017 07:35:49 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/ms-blogs.php
r40340 r40346 444 444 * @since 3.5.0 445 445 * 446 * @global bool $_wp_suspend_cache_invalidation 447 * 446 448 * @param WP_Site $blog The site object to be cleared from cache. 447 449 */ 448 450 function clean_blog_cache( $blog ) { 451 global $_wp_suspend_cache_invalidation; 452 453 if ( ! empty( $_wp_suspend_cache_invalidation ) ) { 454 return; 455 } 456 449 457 $blog_id = $blog->blog_id; 450 458 $domain_path_key = md5( $blog->domain . $blog->path ); … … 452 460 wp_cache_delete( $blog_id, 'sites' ); 453 461 wp_cache_delete( $blog_id, 'site-details' ); 454 wp_cache_delete( $blog_id 462 wp_cache_delete( $blog_id, 'blog-details' ); 455 463 wp_cache_delete( $blog_id . 'short' , 'blog-details' ); 456 wp_cache_delete( $domain_path_key, 'blog-lookup' ); 464 wp_cache_delete( $domain_path_key, 'blog-lookup' ); 465 wp_cache_delete( $domain_path_key, 'blog-id-cache' ); 457 466 wp_cache_delete( 'current_blog_' . $blog->domain, 'site-options' ); 458 467 wp_cache_delete( 'current_blog_' . $blog->domain . $blog->path, 'site-options' ); 459 wp_cache_delete( $domain_path_key, 'blog-id-cache' );460 468 461 469 /** … … 1150 1158 * @since 4.6.0 1151 1159 * 1160 * @global bool $_wp_suspend_cache_invalidation 1161 * 1152 1162 * @param int|array $ids Network ID or an array of network IDs to remove from cache. 1153 1163 */ 1154 1164 function clean_network_cache( $ids ) { 1165 global $_wp_suspend_cache_invalidation; 1166 1167 if ( ! empty( $_wp_suspend_cache_invalidation ) ) { 1168 return; 1169 } 1170 1155 1171 foreach ( (array) $ids as $id ) { 1156 1172 wp_cache_delete( $id, 'networks' ); -
trunk/tests/phpunit/tests/multisite/site.php
r39173 r40346 121 121 wp_update_network_counts(); 122 122 $this->assertEquals( 2, (int) get_blog_count() ); 123 } 124 125 public function test_site_caches_should_invalidate_when_invalidation_is_not_suspended() { 126 $site_id = self::factory()->blog->create(); 127 128 $details = get_site( $site_id ); 129 130 $suspend = wp_suspend_cache_invalidation( false ); 131 update_blog_details( $site_id, array( 'path' => '/a-non-random-test-path/' ) ); 132 $new_details = get_site( $site_id ); 133 wp_suspend_cache_invalidation( $suspend ); 134 135 $this->assertNotEquals( $details->path, $new_details->path ); 136 } 137 138 public function test_site_caches_should_not_invalidate_when_invalidation_is_suspended() { 139 $site_id = self::factory()->blog->create(); 140 141 $details = get_site( $site_id ); 142 143 $suspend = wp_suspend_cache_invalidation(); 144 update_blog_details( $site_id, array( 'path' => '/a-non-random-test-path/' ) ); 145 $new_details = get_site( $site_id ); 146 wp_suspend_cache_invalidation( $suspend ); 147 148 $this->assertEquals( $details->path, $new_details->path ); 123 149 } 124 150
Note: See TracChangeset
for help on using the changeset viewer.