mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Nuke
synced 2024-11-15 03:35:39 +00:00
Replace Linker::link() with LinkRenderer
This updates the hook handler in order to not rely on global state. This also raises MediaWiki version requirement to 1.28.1 and bumps the version number to 1.3.0. Bug: T149346 Change-Id: I9b1d877046c4cb6548bd8f40306ff7905b766f14
This commit is contained in:
parent
6730b3ae3a
commit
444d8de418
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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" );
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue