WordPress.org

Make WordPress Core

Changeset 21194


Ignore:
Timestamp:
06/30/2012 11:49:02 AM (9 years ago)
Author:
nacin
Message:

Don't use switch_to_blog() in wp.getUsersBlogs to improve performance and memory footprint. props mohanjith for initial patch. fixes #20665.

File:
1 edited

Legend:

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

    r21158 r21194  
    474474
    475475            $blog_id = $blog->userblog_id;
    476             switch_to_blog($blog_id);
    477             $is_admin = current_user_can('manage_options');
     476            $is_admin = current_user_can_for_blog( $blog_id, 'manage_options' );
    478477
    479478            $struct[] = array(
    480479                'isAdmin'       => $is_admin,
    481                 'url'           => get_option( 'home' ) . '/',
     480                'url'           => get_home_url( $blog_id, '/' ),
    482481                'blogid'        => (string) $blog_id,
    483                 'blogName'      => get_option( 'blogname' ),
    484                 'xmlrpc'        => site_url( 'xmlrpc.php' )
     482                'blogName'      => get_blog_option( $blog_id, 'blogname' ),
     483                'xmlrpc'        => get_site_url( $blog_id, 'xmlrpc.php' )
    485484            );
    486 
    487             restore_current_blog();
    488485        }
    489486
Note: See TracChangeset for help on using the changeset viewer.