summaryrefslogtreecommitdiff
path: root/includes/api/ApiUnblock.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2012-05-03 13:01:35 +0200
committerPierre Schmitz <pierre@archlinux.de>2012-05-03 13:01:35 +0200
commitd9022f63880ce039446fba8364f68e656b7bf4cb (patch)
tree16b40fbf17bf7c9ee6f4ead25b16dd192378050a /includes/api/ApiUnblock.php
parent27cf83d177256813e2e802241085fce5dd0f3fb9 (diff)
Update to MediaWiki 1.19.0
Diffstat (limited to 'includes/api/ApiUnblock.php')
-rw-r--r--includes/api/ApiUnblock.php19
1 files changed, 7 insertions, 12 deletions
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'