From: umherirrender Date: Wed, 10 Jun 2015 19:24:32 +0000 (+0200) Subject: Simplify SpecialBlockList::preprocessResults X-Git-Tag: 1.31.0-rc.0~11105^2 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=7fd4bc17bc09a81cc6ae2e1bf3d31f99b586d453 Simplify SpecialBlockList::preprocessResults The main query is already joining on ipb_by to the user table, no need for an extra query to get the user names for the LinkBatch Change-Id: Id10fec72cdce9db27b0f366faa760bb34347dc7e --- diff --git a/includes/specials/SpecialBlockList.php b/includes/specials/SpecialBlockList.php index 0ec144a206..4dd313bce8 100644 --- a/includes/specials/SpecialBlockList.php +++ b/includes/specials/SpecialBlockList.php @@ -430,23 +430,18 @@ class BlockListPager extends TablePager { $lb = new LinkBatch; $lb->setCaller( __METHOD__ ); - $userids = array(); - foreach ( $result as $row ) { - $userids[] = $row->ipb_by; - # Usernames and titles are in fact related by a simple substitution of space -> underscore # The last few lines of Title::secureAndSplit() tell the story. $name = str_replace( ' ', '_', $row->ipb_address ); $lb->add( NS_USER, $name ); $lb->add( NS_USER_TALK, $name ); - } - $ua = UserArray::newFromIDs( $userids ); - foreach ( $ua as $user ) { - $name = str_replace( ' ', '_', $user->getName() ); - $lb->add( NS_USER, $name ); - $lb->add( NS_USER_TALK, $name ); + if ( isset( $row->by_user_name ) ) { + $username = str_replace( ' ', '_', $row->by_user_name ); + $lb->add( NS_USER, $username ); + $lb->add( NS_USER_TALK, $username ); + } } $lb->execute();