diff --git a/src/wp-includes/load.php b/src/wp-includes/load.php index 90318acdddcb4..81c2f6eff650e 100644 --- a/src/wp-includes/load.php +++ b/src/wp-includes/load.php @@ -901,7 +901,6 @@ function wp_start_object_cache() { wp_cache_add_global_groups( array( 'blog-details', - 'blog-id-cache', 'blog-lookup', 'blog_meta', 'global-posts', diff --git a/src/wp-includes/ms-blogs.php b/src/wp-includes/ms-blogs.php index 0be865fd87f13..310069e8031d1 100644 --- a/src/wp-includes/ms-blogs.php +++ b/src/wp-includes/ms-blogs.php @@ -555,7 +555,6 @@ function switch_to_blog( $new_blog_id, $deprecated = null ) { wp_cache_add_global_groups( array( 'blog-details', - 'blog-id-cache', 'blog-lookup', 'blog_meta', 'global-posts', @@ -650,7 +649,6 @@ function restore_current_blog() { wp_cache_add_global_groups( array( 'blog-details', - 'blog-id-cache', 'blog-lookup', 'blog_meta', 'global-posts', diff --git a/src/wp-includes/ms-functions.php b/src/wp-includes/ms-functions.php index 38b22fcd8c79a..c26e1938675c4 100644 --- a/src/wp-includes/ms-functions.php +++ b/src/wp-includes/ms-functions.php @@ -350,13 +350,6 @@ function get_blog_permalink( $blog_id, $post_id ) { function get_blog_id_from_url( $domain, $path = '/' ) { $domain = strtolower( $domain ); $path = strtolower( $path ); - $id = wp_cache_get( md5( $domain . $path ), 'blog-id-cache' ); - - if ( -1 === $id ) { // Blog does not exist. - return 0; - } elseif ( $id ) { - return (int) $id; - } $args = array( 'domain' => $domain, @@ -369,12 +362,9 @@ function get_blog_id_from_url( $domain, $path = '/' ) { $id = array_shift( $result ); if ( ! $id ) { - wp_cache_set( md5( $domain . $path ), -1, 'blog-id-cache' ); return 0; } - wp_cache_set( md5( $domain . $path ), $id, 'blog-id-cache' ); - return $id; } diff --git a/src/wp-includes/ms-site.php b/src/wp-includes/ms-site.php index 6399dab72e881..0916857f340ba 100644 --- a/src/wp-includes/ms-site.php +++ b/src/wp-includes/ms-site.php @@ -992,7 +992,6 @@ function clean_blog_cache( $blog ) { 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' ); /** diff --git a/tests/phpunit/includes/abstract-testcase.php b/tests/phpunit/includes/abstract-testcase.php index 3a5d52b0706a9..4eed90b8dcbb8 100644 --- a/tests/phpunit/includes/abstract-testcase.php +++ b/tests/phpunit/includes/abstract-testcase.php @@ -435,7 +435,6 @@ public static function flush_cache() { wp_cache_add_global_groups( array( 'blog-details', - 'blog-id-cache', 'blog-lookup', 'blog_meta', 'global-posts', diff --git a/tests/phpunit/tests/multisite/site.php b/tests/phpunit/tests/multisite/site.php index 920a76f6a7e30..489c12e5fc684 100644 --- a/tests/phpunit/tests/multisite/site.php +++ b/tests/phpunit/tests/multisite/site.php @@ -232,7 +232,6 @@ public function test_data_in_cache_after_wpmu_delete_blog_drop_false() { $this->assertFalse( wp_cache_get( $blog_id, 'blog-details' ) ); $this->assertFalse( wp_cache_get( $blog_id . 'short', 'blog-details' ) ); $this->assertFalse( wp_cache_get( $key, 'blog-lookup' ) ); - $this->assertFalse( wp_cache_get( $key, 'blog-id-cache' ) ); } /** @@ -273,7 +272,6 @@ public function test_data_in_cache_after_wpmu_delete_blog_drop_true() { $this->assertFalse( wp_cache_get( $blog_id, 'blog-details' ) ); $this->assertFalse( wp_cache_get( $blog_id . 'short', 'blog-details' ) ); $this->assertFalse( wp_cache_get( $key, 'blog-lookup' ) ); - $this->assertFalse( wp_cache_get( $key, 'blog-id-cache' ) ); } /** @@ -314,7 +312,6 @@ public function test_data_in_cache_after_wpmu_delete_blog_main_site_drop_true() $this->assertFalse( wp_cache_get( $blog_id, 'blog-details' ) ); $this->assertFalse( wp_cache_get( $blog_id . 'short', 'blog-details' ) ); $this->assertFalse( wp_cache_get( $key, 'blog-lookup' ) ); - $this->assertFalse( wp_cache_get( $key, 'blog-id-cache' ) ); } /** @@ -465,7 +462,6 @@ public function test_get_blog_id_from_url() { // Test the original response and cached response for the newly created site. $this->assertSame( $blog_id, get_blog_id_from_url( $details->domain, $details->path ) ); - $this->assertSame( $blog_id, wp_cache_get( $key, 'blog-id-cache' ) ); } /** @@ -491,7 +487,6 @@ public function test_get_blog_id_from_url_that_does_not_exist() { $details = get_site( $blog_id ); $this->assertSame( 0, get_blog_id_from_url( $details->domain, 'foo' ) ); - $this->assertSame( -1, wp_cache_get( md5( $details->domain . 'foo' ), 'blog-id-cache' ) ); } /** @@ -505,7 +500,6 @@ public function test_get_blog_id_from_url_with_deleted_flag() { wpmu_delete_blog( $blog_id ); $this->assertSame( $blog_id, get_blog_id_from_url( $details->domain, $details->path ) ); - $this->assertSame( $blog_id, wp_cache_get( $key, 'blog-id-cache' ) ); } /** @@ -518,9 +512,7 @@ public function test_get_blog_id_from_url_after_dropped() { $key = md5( $details->domain . $details->path ); wpmu_delete_blog( $blog_id, true ); - $this->assertFalse( wp_cache_get( $key, 'blog-id-cache' ) ); $this->assertSame( 0, get_blog_id_from_url( $details->domain, $details->path ) ); - $this->assertSame( -1, wp_cache_get( $key, 'blog-id-cache' ) ); } /** @@ -1042,7 +1034,6 @@ public function data_get_site_caches() { array( '%blog_id%', 'blog-details' ), array( '%blog_id%' . 'short', 'blog-details' ), array( '%domain_path_key%', 'blog-lookup' ), - array( '%domain_path_key%', 'blog-id-cache' ), ); } @@ -1657,11 +1648,9 @@ public function test_wp_update_site_cleans_old_cache_on_domain_change() { // Ensure all respective cache values are empty. $result = array( wp_cache_get( $domain_path_key_old, 'blog-lookup' ), - wp_cache_get( $domain_path_key_old, 'blog-id-cache' ), wp_cache_get( 'current_blog_' . $old_domain, 'site-options' ), wp_cache_get( 'current_blog_' . $old_domain . '/', 'site-options' ), wp_cache_get( $domain_path_key_new, 'blog-lookup' ), - wp_cache_get( $domain_path_key_new, 'blog-id-cache' ), wp_cache_get( 'current_blog_' . $new_domain, 'site-options' ), wp_cache_get( 'current_blog_' . $new_domain . '/', 'site-options' ), ); @@ -1712,10 +1701,8 @@ public function test_wp_update_site_cleans_old_cache_on_path_change() { // Ensure all respective cache values are empty. $result = array( wp_cache_get( $domain_path_key_old, 'blog-lookup' ), - wp_cache_get( $domain_path_key_old, 'blog-id-cache' ), wp_cache_get( 'current_blog_test.wordpress.org' . $old_path, 'site-options' ), wp_cache_get( $domain_path_key_new, 'blog-lookup' ), - wp_cache_get( $domain_path_key_new, 'blog-id-cache' ), wp_cache_get( 'current_blog_test.wordpress.org' . $new_path, 'site-options' ), );