Make WordPress Core

Changeset 35212


Ignore:
Timestamp:
10/15/2015 10:06:38 PM (9 years ago)
Author:
ocean90
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-network.php

    r35024 r35212  
    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
     
    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}
Note: See TracChangeset for help on using the changeset viewer.