Make WordPress Core

Changeset 27161


Ignore:
Timestamp:
02/11/2014 04:27:05 PM (11 years ago)
Author:
wonderboymusic
Message:

In remove_user_from_blog(), avoid a potentially expensive IN query before invalidating the reassigned post and link caches.

Props kovshenin.
Fixes #25545. (Again.)

File:
1 edited

Legend:

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

    r27152 r27161  
    280280
    281281        if ( ! empty( $post_ids ) ) {
    282             $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_author = %d WHERE ID IN (" . implode( ',', $post_ids ) . ")", $reassign ) );
     282            $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_author = %d WHERE post_author = %d", $reassign, $user_id ) );
    283283            array_walk( $post_ids, 'clean_post_cache' );
    284284        }
    285285
    286286        if ( ! empty( $link_ids ) ) {
    287             $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->links SET link_owner = %d WHERE ID IN (" . implode( ',', $link_ids ) . ")", $reassign ) );
     287            $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->links SET link_owner = %d WHERE link_owner = %d", $reassign, $user_id ) );
    288288            array_walk( $link_ids, 'clean_bookmark_cache' );
    289289        }
Note: See TracChangeset for help on using the changeset viewer.