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
This commit is contained in:
Dominik Schilling (ocean90) 2015-10-15 22:06:38 +00:00
parent c6e2e6c1b5
commit f75321f3ec

View File

@ -209,13 +209,13 @@ class WP_Network {
if ( wp_using_ext_object_cache() ) {
$using_paths = wp_cache_get( 'networks_have_paths', 'site-options' );
if ( false === $using_paths ) {
$using_paths = $wpdb->get_var( "SELECT id FROM {$wpdb->site} WHERE path <> '/' LIMIT 1" );
wp_cache_add( 'networks_have_paths', (int) $using_paths, 'site-options' );
$using_paths = (int) $wpdb->get_var( "SELECT id FROM {$wpdb->site} WHERE path <> '/' LIMIT 1" );
wp_cache_add( 'networks_have_paths', $using_paths, 'site-options' );
}
}
$paths = array();
if ( true === $using_paths ) {
if ( $using_paths ) {
$path_segments = array_filter( explode( '/', trim( $path, '/' ) ) );
/**
@ -272,7 +272,7 @@ class WP_Network {
$search_domains = "'" . implode( "', '", $wpdb->_escape( $domains ) ) . "'";
if ( false === $using_paths ) {
if ( ! $using_paths ) {
$network = $wpdb->get_row( "
SELECT * FROM {$wpdb->site}
WHERE domain IN ({$search_domains})