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
*
* @param $userId Integer
* @param $userPageTitle Title
* @param $toolLinks Array
*
* @return true
* @param int $userId
* @param Title $userPageTitle
* @param string[] $toolLinks
* @param SpecialPage $sp
*/
public static function nukeContributionsLinks( $userId, $userPageTitle, &$toolLinks ) {
global $wgUser;
if ( $wgUser->isAllowed( 'nuke' ) ) {
$toolLinks[] = Linker::link(
public static function nukeContributionsLinks( $userId, $userPageTitle, &$toolLinks,
SpecialPage $sp
) {
if ( $sp->getUser()->isAllowed( 'nuke' ) ) {
$toolLinks['nuke'] = $sp->getLinkRenderer()->makeKnownLink(
SpecialPage::getTitleFor( 'Nuke' ),
wfMessage( 'nuke-linkoncontribs' )->escaped(),
[ 'title' => wfMessage( 'nuke-linkoncontribs-text' )->text() ],
$sp->msg( 'nuke-linkoncontribs' )->text(),
[ 'title' => $sp->msg( 'nuke-linkoncontribs-text' )->text() ],
[ 'target' => $userPageTitle->getText() ]
);
}
return true;
}
}

View file

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

View file

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