Make WordPress Core


Ignore:
Timestamp:
01/30/2025 11:20:58 AM (10 months ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Use strict comparison in wp_xmlrpc_server::wp_getUsersBlogs().

Includes a micro-optimization to avoid calling get_current_network_id() in a loop.

Follow-up to [8075], [9798], [26120], [38814].

Props aristath, poena, afercia, SergeyBiryukov.
See #62279.

File:
1 edited

Legend:

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

    r59726 r59738  
    736736        do_action( 'xmlrpc_call', 'wp.getUsersBlogs', $args, $this );
    737737
    738         $blogs           = (array) get_blogs_of_user( $user->ID );
    739         $struct          = array();
     738        $blogs  = (array) get_blogs_of_user( $user->ID );
     739        $struct = array();
     740
    740741        $primary_blog_id = 0;
    741742        $active_blog     = get_active_blog_for_user( $user->ID );
     
    744745        }
    745746
     747        $current_network_id = get_current_network_id();
     748
    746749        foreach ( $blogs as $blog ) {
    747750            // Don't include blogs that aren't hosted at this site.
    748             if ( get_current_network_id() != $blog->site_id ) {
     751            if ( $blog->site_id !== $current_network_id ) {
    749752                continue;
    750753            }
Note: See TracChangeset for help on using the changeset viewer.