mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Nuke
synced 2024-12-04 12:48:34 +00:00
2ae6a87f6a
Raise required MW version to >= 1.35.0 Bug: T242556 Change-Id: I1a61cf5e1a66fcde3edd5b010eb8c34de4b47dc3
29 lines
766 B
PHP
29 lines
766 B
PHP
<?php
|
|
|
|
use Wikimedia\IPUtils;
|
|
|
|
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' ) && !IPUtils::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 ]
|
|
);
|
|
}
|
|
}
|
|
}
|