Merge "Replace Linker::link() with LinkRenderer"

This commit is contained in:
jenkins-bot 2017-03-01 19:58:50 +00:00 committed by Gerrit Code Review
commit 75ce6d6a68
3 changed files with 19 additions and 18 deletions

View file

@ -5,24 +5,21 @@ class NukeHooks {
/** /**
* Shows link to Special:Nuke on Special:Contributions/username if applicable * Shows link to Special:Nuke on Special:Contributions/username if applicable
* *
* @param $userId Integer * @param int $userId
* @param $userPageTitle Title * @param Title $userPageTitle
* @param $toolLinks Array * @param string[] $toolLinks
* * @param SpecialPage $sp
* @return true
*/ */
public static function nukeContributionsLinks( $userId, $userPageTitle, &$toolLinks ) { public static function nukeContributionsLinks( $userId, $userPageTitle, &$toolLinks,
global $wgUser; SpecialPage $sp
) {
if ( $wgUser->isAllowed( 'nuke' ) ) { if ( $sp->getUser()->isAllowed( 'nuke' ) ) {
$toolLinks[] = Linker::link( $toolLinks['nuke'] = $sp->getLinkRenderer()->makeKnownLink(
SpecialPage::getTitleFor( 'Nuke' ), SpecialPage::getTitleFor( 'Nuke' ),
wfMessage( 'nuke-linkoncontribs' )->escaped(), $sp->msg( 'nuke-linkoncontribs' )->text(),
[ 'title' => wfMessage( 'nuke-linkoncontribs-text' )->text() ], [ 'title' => $sp->msg( 'nuke-linkoncontribs-text' )->text() ],
[ 'target' => $userPageTitle->getText() ] [ 'target' => $userPageTitle->getText() ]
); );
} }
return true;
} }
} }

View file

@ -201,6 +201,7 @@ class SpecialNuke extends SpecialPage {
$wordSeparator = $this->msg( 'word-separator' )->escaped(); $wordSeparator = $this->msg( 'word-separator' )->escaped();
$commaSeparator = $this->msg( 'comma-separator' )->escaped(); $commaSeparator = $this->msg( 'comma-separator' )->escaped();
$linkRenderer = $this->getLinkRenderer();
foreach ( $pages as $info ) { foreach ( $pages as $info ) {
/** /**
* @var $title Title * @var $title Title
@ -215,9 +216,9 @@ class SpecialNuke extends SpecialPage {
$userNameText = $userName ? $userNameText = $userName ?
$this->msg( 'nuke-editby', $userName )->parse() . $commaSeparator : $this->msg( 'nuke-editby', $userName )->parse() . $commaSeparator :
''; '';
$changesLink = Linker::linkKnown( $changesLink = $linkRenderer->makeKnownLink(
$title, $title,
$this->msg( 'nuke-viewchanges' )->escaped(), $this->msg( 'nuke-viewchanges' )->text(),
[], [],
[ 'action' => 'history' ] [ 'action' => 'history' ]
); );
@ -228,7 +229,7 @@ class SpecialNuke extends SpecialPage {
[ 'value' => $title->getPrefixedDBkey() ] [ 'value' => $title->getPrefixedDBkey() ]
) . ' ' . ) . ' ' .
( $thumb ? $thumb->toHtml( [ 'desc-link' => true ] ) : '' ) . ( $thumb ? $thumb->toHtml( [ 'desc-link' => true ] ) : '' ) .
Linker::linkKnown( $title ) . $wordSeparator . $linkRenderer->makeKnownLink( $title ) . $wordSeparator .
$this->msg( 'parentheses' )->rawParams( $userNameText . $changesLink )->escaped() . $this->msg( 'parentheses' )->rawParams( $userNameText . $changesLink )->escaped() .
"</li>\n" ); "</li>\n" );
} }

View file

@ -1,6 +1,6 @@
{ {
"name": "Nuke", "name": "Nuke",
"version": "1.2.0", "version": "1.3.0",
"author": [ "author": [
"Brion Vibber", "Brion Vibber",
"Jeroen De Dauw" "Jeroen De Dauw"
@ -8,6 +8,9 @@
"url": "https://www.mediawiki.org/wiki/Extension:Nuke", "url": "https://www.mediawiki.org/wiki/Extension:Nuke",
"descriptionmsg": "nuke-desc", "descriptionmsg": "nuke-desc",
"license-name": "GPL-2.0+", "license-name": "GPL-2.0+",
"requires": {
"MediaWiki": ">= 1.28.1"
},
"type": "specialpage", "type": "specialpage",
"ExtensionMessagesFiles": { "ExtensionMessagesFiles": {
"NukeAlias": "Nuke.alias.php" "NukeAlias": "Nuke.alias.php"