From d9022f63880ce039446fba8364f68e656b7bf4cb Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Thu, 3 May 2012 13:01:35 +0200 Subject: Update to MediaWiki 1.19.0 --- includes/api/ApiUnblock.php | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'includes/api/ApiUnblock.php') diff --git a/includes/api/ApiUnblock.php b/includes/api/ApiUnblock.php index 9c3bcf69..db94fd5b 100644 --- a/includes/api/ApiUnblock.php +++ b/includes/api/ApiUnblock.php @@ -24,11 +24,6 @@ * @file */ -if ( !defined( 'MEDIAWIKI' ) ) { - // Eclipse helper - will be ignored in production - require_once( "ApiBase.php" ); -} - /** * API module that facilitates the unblocking of users. Requires API write mode * to be enabled. @@ -45,11 +40,11 @@ class ApiUnblock extends ApiBase { * Unblocks the specified user or provides the reason the unblock failed. */ public function execute() { - global $wgUser; + $user = $this->getUser(); $params = $this->extractRequestParams(); if ( $params['gettoken'] ) { - $res['unblocktoken'] = $wgUser->editToken( '', $this->getMain()->getRequest() ); + $res['unblocktoken'] = $user->getEditToken( '', $this->getMain()->getRequest() ); $this->getResult()->addValue( null, $this->getModuleName(), $res ); return; } @@ -61,12 +56,12 @@ class ApiUnblock extends ApiBase { $this->dieUsageMsg( 'unblock-idanduser' ); } - if ( !$wgUser->isAllowed( 'block' ) ) { + if ( !$user->isAllowed( 'block' ) ) { $this->dieUsageMsg( 'cantunblock' ); } # bug 15810: blocked admins should have limited access here - if ( $wgUser->isBlocked() ) { - $status = SpecialBlock::checkUnblockSelf( $params['user'] ); + if ( $user->isBlocked() ) { + $status = SpecialBlock::checkUnblockSelf( $params['user'], $user ); if ( $status !== true ) { $this->dieUsageMsg( $status ); } @@ -77,7 +72,7 @@ class ApiUnblock extends ApiBase { 'Reason' => is_null( $params['reason'] ) ? '' : $params['reason'] ); $block = Block::newFromTarget( $data['Target'] ); - $retval = SpecialUnblock::processUnblock( $data ); + $retval = SpecialUnblock::processUnblock( $data, $this->getContext() ); if ( $retval !== true ) { $this->dieUsageMsg( $retval[0] ); } @@ -141,7 +136,7 @@ class ApiUnblock extends ApiBase { return ''; } - protected function getExamples() { + public function getExamples() { return array( 'api.php?action=unblock&id=105', 'api.php?action=unblock&user=Bob&reason=Sorry%20Bob' -- cgit v1.2.3-54-g00ecf