From b72c1d00ae3a2b8fd6cd5f87837ae157d4231e55 Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Wed, 6 Apr 2022 04:33:50 +0000 Subject: [PATCH] Networks and Sites: Remove duplicate cache entry. Remove the `networks_have_paths, site-options` cache entry as it duplicates caching within the `WP_Network_Query` class. Props uday17035, spacedmonkey, johnbillion, johnjamesjacoby. Fixes #42070. git-svn-id: https://develop.svn.wordpress.org/trunk@53083 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/schema.php | 2 -- src/wp-includes/class-wp-network.php | 18 +++++++----------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/wp-admin/includes/schema.php b/src/wp-admin/includes/schema.php index 89ca9d8b30..a9978bc3b3 100644 --- a/src/wp-admin/includes/schema.php +++ b/src/wp-admin/includes/schema.php @@ -1173,8 +1173,6 @@ function populate_network_meta( $network_id, array $meta = array() ) { wp_cache_delete( $network_id, 'networks' ); } - wp_cache_delete( 'networks_have_paths', 'site-options' ); - if ( ! is_multisite() ) { $site_admins = array( $site_user->user_login ); $users = get_users( diff --git a/src/wp-includes/class-wp-network.php b/src/wp-includes/class-wp-network.php index fbd922951a..956fb6ddac 100644 --- a/src/wp-includes/class-wp-network.php +++ b/src/wp-includes/class-wp-network.php @@ -353,17 +353,13 @@ class WP_Network { */ $using_paths = true; if ( wp_using_ext_object_cache() ) { - $using_paths = wp_cache_get( 'networks_have_paths', 'site-options' ); - if ( false === $using_paths ) { - $using_paths = get_networks( - array( - 'number' => 1, - 'count' => true, - 'path__not_in' => '/', - ) - ); - wp_cache_add( 'networks_have_paths', $using_paths, 'site-options' ); - } + $using_paths = get_networks( + array( + 'number' => 1, + 'count' => true, + 'path__not_in' => '/', + ) + ); } $paths = array();