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.
Built from https://develop.svn.wordpress.org/trunk@35212


git-svn-id: http://core.svn.wordpress.org/trunk@35178 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dominik Schilling 2015-10-15 22:07:24 +00:00
parent 272ff97709
commit 22874716dd
2 changed files with 5 additions and 5 deletions

View File

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

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.4-alpha-35211'; $wp_version = '4.4-alpha-35212';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.