mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Nuke
synced 2024-11-15 11:59:48 +00:00
444d8de418
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
26 lines
666 B
PHP
26 lines
666 B
PHP
<?php
|
|
|
|
class NukeHooks {
|
|
|
|
/**
|
|
* Shows link to Special:Nuke on Special:Contributions/username if applicable
|
|
*
|
|
* @param int $userId
|
|
* @param Title $userPageTitle
|
|
* @param string[] $toolLinks
|
|
* @param SpecialPage $sp
|
|
*/
|
|
public static function nukeContributionsLinks( $userId, $userPageTitle, &$toolLinks,
|
|
SpecialPage $sp
|
|
) {
|
|
if ( $sp->getUser()->isAllowed( 'nuke' ) ) {
|
|
$toolLinks['nuke'] = $sp->getLinkRenderer()->makeKnownLink(
|
|
SpecialPage::getTitleFor( 'Nuke' ),
|
|
$sp->msg( 'nuke-linkoncontribs' )->text(),
|
|
[ 'title' => $sp->msg( 'nuke-linkoncontribs-text' )->text() ],
|
|
[ 'target' => $userPageTitle->getText() ]
|
|
);
|
|
}
|
|
}
|
|
}
|