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

Change subject: Replace Linker::link() with LinkRenderer in some special pages
......................................................................


Replace Linker::link() with LinkRenderer in some special pages

* SpecialEditTags
* SpecialEmailuser
* SpecialFewestrevisions
* SpecialImport
* SpecialListgrouprights
* SpecialMediaStatistics
* SpecialMergeHistory
* SpecialMIMEsearch
* SpecialMostcategories
* SpecialMostinerwikis
* SpecialMostlinked

Bug: T149346
Change-Id: Idee566dbff87f2e8bf909ba8371d551aaf0dd08b
---
M includes/specials/SpecialEditTags.php
M includes/specials/SpecialEmailuser.php
M includes/specials/SpecialFewestrevisions.php
M includes/specials/SpecialFileDuplicateSearch.php
M includes/specials/SpecialImport.php
M includes/specials/SpecialListgrouprights.php
M includes/specials/SpecialMIMEsearch.php
M includes/specials/SpecialMediaStatistics.php
M includes/specials/SpecialMergeHistory.php
M includes/specials/SpecialMostcategories.php
M includes/specials/SpecialMostinterwikis.php
M includes/specials/SpecialMostlinked.php
12 files changed, 63 insertions(+), 46 deletions(-)

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



diff --git a/includes/specials/SpecialEditTags.php 
b/includes/specials/SpecialEditTags.php
index 252d076..476c452 100644
--- a/includes/specials/SpecialEditTags.php
+++ b/includes/specials/SpecialEditTags.php
@@ -158,10 +158,11 @@
                        // Also set header tabs to be for the target.
                        $this->getSkin()->setRelevantTitle( $this->targetObj );
 
+                       $linkRenderer = $this->getLinkRenderer();
                        $links = [];
-                       $links[] = Linker::linkKnown(
+                       $links[] = $linkRenderer->makeKnownLink(
                                SpecialPage::getTitleFor( 'Log' ),
-                               $this->msg( 'viewpagelogs' )->escaped(),
+                               $this->msg( 'viewpagelogs' )->text(),
                                [],
                                [
                                        'page' => 
$this->targetObj->getPrefixedText(),
@@ -170,17 +171,17 @@
                        );
                        if ( !$this->targetObj->isSpecialPage() ) {
                                // Give a link to the page history
-                               $links[] = Linker::linkKnown(
+                               $links[] = $linkRenderer->makeKnownLink(
                                        $this->targetObj,
-                                       $this->msg( 'pagehist' )->escaped(),
+                                       $this->msg( 'pagehist' )->text(),
                                        [],
                                        [ 'action' => 'history' ]
                                );
                        }
                        // Link to Special:Tags
-                       $links[] = Linker::linkKnown(
+                       $links[] = $linkRenderer->makeKnownLink(
                                SpecialPage::getTitleFor( 'Tags' ),
-                               $this->msg( 'tags-edit-manage-link' )->escaped()
+                               $this->msg( 'tags-edit-manage-link' )->text()
                        );
                        // Logs themselves don't have histories or archived 
revisions
                        $this->getOutput()->addSubtitle( 
$this->getLanguage()->pipeList( $links ) );
diff --git a/includes/specials/SpecialEmailuser.php 
b/includes/specials/SpecialEmailuser.php
index a550e88..9692dd0 100644
--- a/includes/specials/SpecialEmailuser.php
+++ b/includes/specials/SpecialEmailuser.php
@@ -53,13 +53,14 @@
        }
 
        protected function getFormFields() {
+               $linkRenderer = $this->getLinkRenderer();
                return [
                        'From' => [
                                'type' => 'info',
                                'raw' => 1,
-                               'default' => Linker::link(
+                               'default' => $linkRenderer->makeLink(
                                        $this->getUser()->getUserPage(),
-                                       htmlspecialchars( 
$this->getUser()->getName() )
+                                       $this->getUser()->getName()
                                ),
                                'label-message' => 'emailfrom',
                                'id' => 'mw-emailuser-sender',
@@ -67,9 +68,9 @@
                        'To' => [
                                'type' => 'info',
                                'raw' => 1,
-                               'default' => Linker::link(
+                               'default' => $linkRenderer->makeLink(
                                        $this->mTargetObj->getUserPage(),
-                                       htmlspecialchars( 
$this->mTargetObj->getName() )
+                                       $this->mTargetObj->getName()
                                ),
                                'label-message' => 'emailto',
                                'id' => 'mw-emailuser-recipient',
diff --git a/includes/specials/SpecialFewestrevisions.php 
b/includes/specials/SpecialFewestrevisions.php
index b86a95e..d7879ff 100644
--- a/includes/specials/SpecialFewestrevisions.php
+++ b/includes/specials/SpecialFewestrevisions.php
@@ -88,14 +88,14 @@
                                )
                        );
                }
+               $linkRenderer = $this->getLinkRenderer();
+               $text = $wgContLang->convert( $nt->getPrefixedText() );
+               $plink = $linkRenderer->makeLink( $nt, $text );
 
-               $text = htmlspecialchars( $wgContLang->convert( 
$nt->getPrefixedText() ) );
-               $plink = Linker::linkKnown( $nt, $text );
-
-               $nl = $this->msg( 'nrevisions' )->numParams( $result->value 
)->escaped();
+               $nl = $this->msg( 'nrevisions' )->numParams( $result->value 
)->text();
                $redirect = isset( $result->redirect ) && $result->redirect ?
                        ' - ' . $this->msg( 'isredirect' )->escaped() : '';
-               $nlink = Linker::linkKnown(
+               $nlink = $linkRenderer->makeKnownLink(
                        $nt,
                        $nl,
                        [],
diff --git a/includes/specials/SpecialFileDuplicateSearch.php 
b/includes/specials/SpecialFileDuplicateSearch.php
index 6de127d..8021bc2 100644
--- a/includes/specials/SpecialFileDuplicateSearch.php
+++ b/includes/specials/SpecialFileDuplicateSearch.php
@@ -208,11 +208,12 @@
        function formatResult( $skin, $result ) {
                global $wgContLang;
 
+               $linkRenderer = $this->getLinkRenderer();
                $nt = $result->getTitle();
                $text = $wgContLang->convert( $nt->getText() );
-               $plink = Linker::link(
+               $plink = $linkRenderer->makeLink(
                        $nt,
-                       htmlspecialchars( $text )
+                       $text
                );
 
                $userText = $result->getUser( 'text' );
diff --git a/includes/specials/SpecialImport.php 
b/includes/specials/SpecialImport.php
index c58af60..ce88624 100644
--- a/includes/specials/SpecialImport.php
+++ b/includes/specials/SpecialImport.php
@@ -24,6 +24,8 @@
  * @ingroup SpecialPage
  */
 
+use MediaWiki\MediaWikiServices;
+
 /**
  * MediaWiki page data importer
  *
@@ -592,12 +594,12 @@
                }
 
                $this->mPageCount++;
-
+               $linkRenderer = 
MediaWikiServices::getInstance()->getLinkRenderer();
                if ( $successCount > 0 ) {
                        // <bdi> prevents jumbling of the versions count
                        // in RTL wikis in case the page title is LTR
                        $this->getOutput()->addHTML(
-                               "<li>" . Linker::linkKnown( $title ) . " " .
+                               "<li>" . $linkRenderer->makeLink( $title ) . " 
" .
                                        "<bdi>" .
                                        $this->msg( 'import-revision-count' 
)->numParams( $successCount )->escaped() .
                                        "</bdi>" .
@@ -656,7 +658,7 @@
                                );
                        }
                } else {
-                       $this->getOutput()->addHTML( "<li>" . 
Linker::linkKnown( $title ) . " " .
+                       $this->getOutput()->addHTML( "<li>" . 
$linkRenderer->makeKnownLink( $title ) . " " .
                                $this->msg( 'import-nonewrevisions' 
)->escaped() . "</li>\n" );
                }
        }
diff --git a/includes/specials/SpecialListgrouprights.php 
b/includes/specials/SpecialListgrouprights.php
index d64306b..f3d3a77 100644
--- a/includes/specials/SpecialListgrouprights.php
+++ b/includes/specials/SpecialListgrouprights.php
@@ -71,6 +71,8 @@
                ) );
                asort( $allGroups );
 
+               $linkRenderer = $this->getLinkRenderer();
+
                foreach ( $allGroups as $group ) {
                        $permissions = isset( $groupPermissions[$group] )
                                ? $groupPermissions[$group]
@@ -92,22 +94,22 @@
                                // Do not make a link for the generic * group 
or group with invalid group page
                                $grouppage = htmlspecialchars( 
$groupnameLocalized );
                        } else {
-                               $grouppage = Linker::link(
+                               $grouppage = $linkRenderer->makeLink(
                                        $grouppageLocalizedTitle,
-                                       htmlspecialchars( $groupnameLocalized )
+                                       $groupnameLocalized
                                );
                        }
 
                        if ( $group === 'user' ) {
                                // Link to Special:listusers for implicit group 
'user'
-                               $grouplink = '<br />' . Linker::linkKnown(
+                               $grouplink = '<br />' . 
$linkRenderer->makeKnownLink(
                                        SpecialPage::getTitleFor( 'Listusers' ),
-                                       $this->msg( 'listgrouprights-members' 
)->escaped()
+                                       $this->msg( 'listgrouprights-members' 
)->text()
                                );
                        } elseif ( !in_array( $group, $config->get( 
'ImplicitGroups' ) ) ) {
-                               $grouplink = '<br />' . Linker::linkKnown(
+                               $grouplink = '<br />' . 
$linkRenderer->makeKnownLink(
                                        SpecialPage::getTitleFor( 'Listusers' ),
-                                       $this->msg( 'listgrouprights-members' 
)->escaped(),
+                                       $this->msg( 'listgrouprights-members' 
)->text(),
                                        [],
                                        [ 'group' => $group ]
                                );
@@ -165,7 +167,7 @@
                                $this->msg( 
'listgrouprights-namespaceprotection-restrictedto' )->text()
                        )
                );
-
+               $linkRenderer = $this->getLinkRenderer();
                ksort( $namespaceProtection );
                foreach ( $namespaceProtection as $namespace => $rights ) {
                        if ( !in_array( $namespace, 
MWNamespace::getValidNamespaces() ) ) {
@@ -183,9 +185,9 @@
                                Html::rawElement(
                                        'td',
                                        [],
-                                       Linker::link(
+                                       $linkRenderer->makeLink(
                                                SpecialPage::getTitleFor( 
'Allpages' ),
-                                               htmlspecialchars( 
$namespaceText ),
+                                               $namespaceText,
                                                [],
                                                [ 'namespace' => $namespace ]
                                        )
diff --git a/includes/specials/SpecialMIMEsearch.php 
b/includes/specials/SpecialMIMEsearch.php
index 1d02a4f..c61609d 100644
--- a/includes/specials/SpecialMIMEsearch.php
+++ b/includes/specials/SpecialMIMEsearch.php
@@ -153,11 +153,12 @@
        function formatResult( $skin, $result ) {
                global $wgContLang;
 
+               $linkRenderer = $this->getLinkRenderer();
                $nt = Title::makeTitle( $result->namespace, $result->title );
                $text = $wgContLang->convert( $nt->getText() );
-               $plink = Linker::link(
+               $plink = $linkRenderer->makeLink(
                        Title::newFromText( $nt->getPrefixedText() ),
-                       htmlspecialchars( $text )
+                       $text
                );
 
                $download = Linker::makeMediaLinkObj( $nt, $this->msg( 
'download' )->escaped() );
@@ -166,9 +167,9 @@
                $bytes = htmlspecialchars( $lang->formatSize( $result->img_size 
) );
                $dimensions = $this->msg( 'widthheight' )->numParams( 
$result->img_width,
                        $result->img_height )->escaped();
-               $user = Linker::link(
+               $user = $linkRenderer->makeLink(
                        Title::makeTitle( NS_USER, $result->img_user_text ),
-                       htmlspecialchars( $result->img_user_text )
+                       $result->img_user_text
                );
 
                $time = $lang->userTimeAndDate( $result->img_timestamp, 
$this->getUser() );
diff --git a/includes/specials/SpecialMediaStatistics.php 
b/includes/specials/SpecialMediaStatistics.php
index 7683ad8..e11977f 100644
--- a/includes/specials/SpecialMediaStatistics.php
+++ b/includes/specials/SpecialMediaStatistics.php
@@ -174,10 +174,11 @@
         */
        protected function outputTableRow( $mime, $count, $bytes ) {
                $mimeSearch = SpecialPage::getTitleFor( 'MIMEsearch', $mime );
+               $linkRenderer = $this->getLinkRenderer();
                $row = Html::rawElement(
                        'td',
                        [],
-                       Linker::link( $mimeSearch, htmlspecialchars( $mime ) )
+                       $linkRenderer->makeLink( $mimeSearch, $mime )
                );
                $row .= Html::element(
                        'td',
diff --git a/includes/specials/SpecialMergeHistory.php 
b/includes/specials/SpecialMergeHistory.php
index b916c1f..f122db8 100644
--- a/includes/specials/SpecialMergeHistory.php
+++ b/includes/specials/SpecialMergeHistory.php
@@ -277,6 +277,8 @@
        function formatRevisionRow( $row ) {
                $rev = new Revision( $row );
 
+               $linkRenderer = $this->getLinkRenderer();
+
                $stxt = '';
                $last = $this->msg( 'last' )->escaped();
 
@@ -285,9 +287,9 @@
 
                $user = $this->getUser();
 
-               $pageLink = Linker::linkKnown(
+               $pageLink = $linkRenderer->makeKnownLink(
                        $rev->getTitle(),
-                       htmlspecialchars( 
$this->getLanguage()->userTimeAndDate( $ts, $user ) ),
+                       $this->getLanguage()->userTimeAndDate( $ts, $user ),
                        [],
                        [ 'oldid' => $rev->getId() ]
                );
@@ -299,9 +301,9 @@
                if ( !$rev->userCan( Revision::DELETED_TEXT, $user ) ) {
                        $last = $this->msg( 'last' )->escaped();
                } elseif ( isset( $this->prevId[$row->rev_id] ) ) {
-                       $last = Linker::linkKnown(
+                       $last = $linkRenderer->makeKnownLink(
                                $rev->getTitle(),
-                               $this->msg( 'last' )->escaped(),
+                               $this->msg( 'last' )->text(),
                                [],
                                [
                                        'diff' => $row->rev_id,
@@ -359,7 +361,9 @@
                        return false;
                }
 
-               $targetLink = Linker::link(
+               $linkRenderer = $this->getLinkRenderer();
+
+               $targetLink = $linkRenderer->makeLink(
                        $targetTitle,
                        null,
                        [],
diff --git a/includes/specials/SpecialMostcategories.php 
b/includes/specials/SpecialMostcategories.php
index 015701d..6095412 100644
--- a/includes/specials/SpecialMostcategories.php
+++ b/includes/specials/SpecialMostcategories.php
@@ -91,10 +91,11 @@
                        );
                }
 
+               $linkRenderer = $this->getLinkRenderer();
                if ( $this->isCached() ) {
-                       $link = Linker::link( $title );
+                       $link = $linkRenderer->makeLink( $title );
                } else {
-                       $link = Linker::linkKnown( $title );
+                       $link = $linkRenderer->makeKnownLink( $title );
                }
 
                $count = $this->msg( 'ncategories' )->numParams( $result->value 
)->escaped();
diff --git a/includes/specials/SpecialMostinterwikis.php 
b/includes/specials/SpecialMostinterwikis.php
index 3e78352..210c4a2 100644
--- a/includes/specials/SpecialMostinterwikis.php
+++ b/includes/specials/SpecialMostinterwikis.php
@@ -97,10 +97,11 @@
                        );
                }
 
+               $linkRenderer = $this->getLinkRenderer();
                if ( $this->isCached() ) {
-                       $link = Linker::link( $title );
+                       $link = $linkRenderer->makeLink( $title );
                } else {
-                       $link = Linker::linkKnown( $title );
+                       $link = $linkRenderer->makeKnownLink( $title );
                }
 
                $count = $this->msg( 'ninterwikis' )->numParams( $result->value 
)->escaped();
diff --git a/includes/specials/SpecialMostlinked.php 
b/includes/specials/SpecialMostlinked.php
index 01eb39e..712574c 100644
--- a/includes/specials/SpecialMostlinked.php
+++ b/includes/specials/SpecialMostlinked.php
@@ -91,7 +91,8 @@
        function makeWlhLink( $title, $caption ) {
                $wlh = SpecialPage::getTitleFor( 'Whatlinkshere', 
$title->getPrefixedDBkey() );
 
-               return Linker::linkKnown( $wlh, $caption );
+               $linkRenderer = $this->getLinkRenderer();
+               return $linkRenderer->makeKnownLink( $wlh, $caption );
        }
 
        /**
@@ -115,10 +116,11 @@
                        );
                }
 
-               $link = Linker::link( $title );
+               $linkRenderer = $this->getLinkRenderer();
+               $link = $linkRenderer->makeLink( $title );
                $wlh = $this->makeWlhLink(
                        $title,
-                       $this->msg( 'nlinks' )->numParams( $result->value 
)->escaped()
+                       $this->msg( 'nlinks' )->numParams( $result->value 
)->text()
                );
 
                return $this->getLanguage()->specialList( $link, $wlh );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Idee566dbff87f2e8bf909ba8371d551aaf0dd08b
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Georggi199 <bmp2...@gmail.com>
Gerrit-Reviewer: Florianschmidtwelzow <florian.schmidt.stargatewis...@gmail.com>
Gerrit-Reviewer: Georggi199 <bmp2...@gmail.com>
Gerrit-Reviewer: Legoktm <lego...@member.fsf.org>
Gerrit-Reviewer: MtDu <justin.d...@gmail.com>
Gerrit-Reviewer: TTO <at.li...@live.com.au>
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