diff options
Diffstat (limited to 'CheckUser/includes/specials/SpecialCheckUserLog.php')
-rw-r--r-- | CheckUser/includes/specials/SpecialCheckUserLog.php | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/CheckUser/includes/specials/SpecialCheckUserLog.php b/CheckUser/includes/specials/SpecialCheckUserLog.php index 81be07f5..e8ccf646 100644 --- a/CheckUser/includes/specials/SpecialCheckUserLog.php +++ b/CheckUser/includes/specials/SpecialCheckUserLog.php @@ -1,24 +1,40 @@ <?php +use MediaWiki\Cache\LinkBatchFactory; +use MediaWiki\MediaWikiServices; +use Wikimedia\IPUtils; + class SpecialCheckUserLog extends SpecialPage { /** - * @var string $target + * @var string */ protected $target; - public function __construct() { + /** @var LinkBatchFactory */ + private $linkBatchFactory; + + public function __construct( LinkBatchFactory $linkBatchFactory ) { parent::__construct( 'CheckUserLog', 'checkuser-log' ); + $this->linkBatchFactory = $linkBatchFactory; } public function execute( $par ) { $this->setHeaders(); + $this->addHelpLink( 'Extension:CheckUser' ); $this->checkPermissions(); + // Blocked users are not allowed to run checkuser queries (bug T157883) + $block = $this->getUser()->getBlock(); + if ( $block && $block->isSitewide() ) { + throw new UserBlockedError( $block ); + } + $out = $this->getOutput(); $request = $this->getRequest(); $this->target = trim( $request->getVal( 'cuSearch', $par ) ); + $permissionManager = MediaWikiServices::getInstance()->getPermissionManager(); - if ( $this->getUser()->isAllowed( 'checkuser' ) ) { + if ( $permissionManager->userHasRight( $this->getUser(), 'checkuser' ) ) { $subtitleLink = $this->getLinkRenderer()->makeKnownLink( SpecialPage::getTitleFor( 'CheckUser' ), $this->msg( 'checkuser-showmain' )->text() @@ -57,7 +73,8 @@ class SpecialCheckUserLog extends SpecialPage { 'queryConds' => $searchConds, 'year' => $request->getInt( 'year' ), 'month' => $request->getInt( 'month' ), - ] + ], + $this->linkBatchFactory ); $out->addHTML( @@ -130,7 +147,7 @@ class SpecialCheckUserLog extends SpecialPage { * @return array|null array if valid target, null if invalid target given */ protected function getTargetSearchConds() { - list( $start, $end ) = IP::parseRange( $this->target ); + list( $start, $end ) = IPUtils::parseRange( $this->target ); $conds = null; if ( $start !== false ) { |