Skip to content

Commit f75321f

Browse files
committed
Multisite: Remove the strictness for $using_paths in WP_Network::get_by_path().
The network lookup was broken when using an external object cache because `$using_paths` isn't always a boolean. Added in [34099]. See #31985, #31491. git-svn-id: https://develop.svn.wordpress.org/trunk@35212 602fd350-edb4-49c9-b593-d223f7449a82
1 parent c6e2e6c commit f75321f

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/wp-includes/class-wp-network.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,13 +209,13 @@ public static function get_by_path( $domain = '', $path = '', $segments = null )
209209
if ( wp_using_ext_object_cache() ) {
210210
$using_paths = wp_cache_get( 'networks_have_paths', 'site-options' );
211211
if ( false === $using_paths ) {
212-
$using_paths = $wpdb->get_var( "SELECT id FROM {$wpdb->site} WHERE path <> '/' LIMIT 1" );
213-
wp_cache_add( 'networks_have_paths', (int) $using_paths, 'site-options' );
212+
$using_paths = (int) $wpdb->get_var( "SELECT id FROM {$wpdb->site} WHERE path <> '/' LIMIT 1" );
213+
wp_cache_add( 'networks_have_paths', $using_paths, 'site-options' );
214214
}
215215
}
216216

217217
$paths = array();
218-
if ( true === $using_paths ) {
218+
if ( $using_paths ) {
219219
$path_segments = array_filter( explode( '/', trim( $path, '/' ) ) );
220220

221221
/**
@@ -272,7 +272,7 @@ public static function get_by_path( $domain = '', $path = '', $segments = null )
272272
273273
$search_domains = "'" . implode( "', '", $wpdb->_escape( $domains ) ) . "'";
274274

275-
if ( false === $using_paths ) {
275+
if ( ! $using_paths ) {
276276
$network = $wpdb->get_row( "
277277
SELECT * FROM {$wpdb->site}
278278
WHERE domain IN ({$search_domains})

0 commit comments

Comments
 (0)