From f307aa1eb8e6bc765b82fa63a114e01f05e2c797 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Tue, 11 Feb 2014 16:28:13 +0000 Subject: [PATCH] In `remove_user_from_blog()`, avoid a potentially expensive `IN` query before invalidating the reassigned post and link caches. Props kovshenin. Fixes #25545. (Again.) Built from https://develop.svn.wordpress.org/trunk@27161 git-svn-id: http://core.svn.wordpress.org/trunk@27027 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/ms-functions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-includes/ms-functions.php b/wp-includes/ms-functions.php index 84e0854db9..2e26cbf9cb 100644 --- a/wp-includes/ms-functions.php +++ b/wp-includes/ms-functions.php @@ -279,12 +279,12 @@ function remove_user_from_blog($user_id, $blog_id = '', $reassign = '') { $link_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->links WHERE link_owner = %d", $user_id ) ); if ( ! empty( $post_ids ) ) { - $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_author = %d WHERE ID IN (" . implode( ',', $post_ids ) . ")", $reassign ) ); + $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_author = %d WHERE post_author = %d", $reassign, $user_id ) ); array_walk( $post_ids, 'clean_post_cache' ); } if ( ! empty( $link_ids ) ) { - $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->links SET link_owner = %d WHERE ID IN (" . implode( ',', $link_ids ) . ")", $reassign ) ); + $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->links SET link_owner = %d WHERE link_owner = %d", $reassign, $user_id ) ); array_walk( $link_ids, 'clean_bookmark_cache' ); } }