mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Nuke
synced 2024-11-15 11:59:48 +00:00
4f9f576d98
Bug: T175915 Change-Id: Idc73e18e3665380147f85ad27b484fade5e877a2
27 lines
737 B
PHP
27 lines
737 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
|
|
) {
|
|
$username = $userPageTitle->getText();
|
|
if ( $sp->getUser()->isAllowed( 'nuke' ) && !IP::isValidRange( $username ) ) {
|
|
$toolLinks['nuke'] = $sp->getLinkRenderer()->makeKnownLink(
|
|
SpecialPage::getTitleFor( 'Nuke' ),
|
|
$sp->msg( 'nuke-linkoncontribs' )->text(),
|
|
[ 'title' => $sp->msg( 'nuke-linkoncontribs-text', $username )->text() ],
|
|
[ 'target' => $username ]
|
|
);
|
|
}
|
|
}
|
|
}
|