jenkins-bot has submitted this change and it was merged.

Change subject: Remove double str_replace( ' ', '_', $ ) when using LinkBatch
......................................................................


Remove double str_replace( ' ', '_', $ ) when using LinkBatch

LinkBatch::add already handle the underscore/space part, that means it
is not need to do it on the caller side when adding user names to
LinkBatch

Change-Id: I09e80712903a539164141cc0a88d321203114677
---
M includes/cache/UserCache.php
M includes/specials/SpecialBlockList.php
2 files changed, 6 insertions(+), 10 deletions(-)

Approvals:
  Aaron Schulz: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/cache/UserCache.php b/includes/cache/UserCache.php
index 8a42489..2a3aac2 100644
--- a/includes/cache/UserCache.php
+++ b/includes/cache/UserCache.php
@@ -123,11 +123,11 @@
                $lb = new LinkBatch();
                foreach ( $usersToCheck as $userId => $name ) {
                        if ( $this->queryNeeded( $userId, 'userpage', $options 
) ) {
-                               $lb->add( NS_USER, str_replace( ' ', '_', 
$row->user_name ) );
+                               $lb->add( NS_USER, $row->user_name );
                                $this->typesCached[$userId]['userpage'] = 1;
                        }
                        if ( $this->queryNeeded( $userId, 'usertalk', $options 
) ) {
-                               $lb->add( NS_USER_TALK, str_replace( ' ', '_', 
$row->user_name ) );
+                               $lb->add( NS_USER_TALK, $row->user_name );
                                $this->typesCached[$userId]['usertalk'] = 1;
                        }
                }
diff --git a/includes/specials/SpecialBlockList.php 
b/includes/specials/SpecialBlockList.php
index 4dd313b..8a9aefd 100644
--- a/includes/specials/SpecialBlockList.php
+++ b/includes/specials/SpecialBlockList.php
@@ -431,16 +431,12 @@
                $lb->setCaller( __METHOD__ );
 
                foreach ( $result as $row ) {
-                       # 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 );
+                       $lb->add( NS_USER, $row->ipb_address );
+                       $lb->add( NS_USER_TALK, $row->ipb_address );
 
                        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->add( NS_USER, $row->by_user_name );
+                               $lb->add( NS_USER_TALK, $row->by_user_name );
                        }
                }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/219444
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I09e80712903a539164141cc0a88d321203114677
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Umherirrender <umherirrender_de...@web.de>
Gerrit-Reviewer: Aaron Schulz <asch...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to