* @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.
* 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;
}
$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 );
}
'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] );
}
}
public function getHelpUrls() {
- return 'http://www.mediawiki.org/wiki/API:Block';
+ return 'https://www.mediawiki.org/wiki/API:Block';
}
public function getVersion() {