From cf48e2166866d5df9ab2d884a2ffadf93be60088 Mon Sep 17 00:00:00 2001 From: umherirrender Date: Fri, 6 Jul 2012 23:48:08 +0200 Subject: [PATCH] Add userToolLinks on Special:FileDuplicateSearch Adding LinkBatch for the file, user and user talk links Also not linking to user of the foreign wiki, because that can bring problems, when the user is not the same as the user on this wiki. ImagePage.php is that already doing when showing the file history. Change-Id: I72f94db11e7346036e53cddbe431d009de6ba2d3 --- .../specials/SpecialFileDuplicateSearch.php | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/includes/specials/SpecialFileDuplicateSearch.php b/includes/specials/SpecialFileDuplicateSearch.php index 18d19db80b..f8e40e0f40 100644 --- a/includes/specials/SpecialFileDuplicateSearch.php +++ b/includes/specials/SpecialFileDuplicateSearch.php @@ -157,10 +157,24 @@ class FileDuplicateSearchPage extends QueryPage { ); } + $this->doBatchLookups( $dupes ); $this->showList( $dupes ); } } + function doBatchLookups( $list ) { + $batch = new LinkBatch(); + foreach( $list as $file ) { + $batch->addObj( $file->getTitle() ); + if( $file->isLocal() ) { + $userName = $file->getUser( 'text' ); + $batch->add( NS_USER, $userName ); + $batch->add( NS_USER_TALK, $userName ); + } + } + $batch->execute(); + } + /** * * @param Skin $skin @@ -178,7 +192,17 @@ class FileDuplicateSearchPage extends QueryPage { ); $userText = $result->getUser( 'text' ); - $user = Linker::link( Title::makeTitle( NS_USER, $userText ), $userText ); + if ( $result->isLocal() ) { + $userId = $result->getUser( 'id' ); + $user = Linker::userLink( $userId, $userText ); + $user .= $this->getContext()->msg( 'word-separator' )->plain(); + $user .= ''; + $user .= Linker::userToolLinks( $userId, $userText ); + $user .= ''; + } else { + $user = htmlspecialchars( $userText ); + } + $time = $this->getLanguage()->userTimeAndDate( $result->getTimestamp(), $this->getUser() ); return "$plink . . $user . . $time"; -- 2.20.1