WordPress.org

WordPress build repository browser

Changeset 42526


Ignore:
Timestamp:
02/11/18 17:09:31 (11 days ago)
Author:
SergeyBiryukov
Message:

Networks and Sites: In get_site_by_path(), use single domain and path parameters if there's only one item to look for.

This should increase the chances of WP_Site_Query::get_sites() hitting an existing cache.

Props spacedmonkey.
Fixes #42299.
Built from https://develop.svn.wordpress.org/trunk@42698

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/ms-load.php

    r42172 r42526  
    235235 
    236236    $args = array( 
    237         'domain__in' => $domains, 
    238         'path__in'   => $paths, 
    239         'number'     => 1, 
     237        'number' => 1, 
    240238    ); 
    241239 
    242240    if ( count( $domains ) > 1 ) { 
     241        $args['domain__in']               = $domains; 
    243242        $args['orderby']['domain_length'] = 'DESC'; 
     243    } else { 
     244        $args['domain'] = array_shift( $domains ); 
    244245    } 
    245246 
    246247    if ( count( $paths ) > 1 ) { 
     248        $args['path__in']               = $paths; 
    247249        $args['orderby']['path_length'] = 'DESC'; 
     250    } else { 
     251        $args['path'] = array_shift( $paths ); 
    248252    } 
    249253 
  • trunk/wp-includes/version.php

    r42525 r42526  
    55 * @global string $wp_version 
    66 */ 
    7 $wp_version = '5.0-alpha-42697'; 
     7$wp_version = '5.0-alpha-42698'; 
    88 
    99/** 
Note: See TracChangeset for help on using the changeset viewer.