X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fapi%2FApiUnblock.php;h=5cef194f363c902a93f64241c26091ff279fe1e0;hp=3aad8f4199f2ecb654816499644ef5a1891de94c;hb=dfec83932fd38a9086eb5a2e212889ad00f35b0e;hpb=7621b57d958d0753236221227cbfb519d7faf192 diff --git a/includes/api/ApiUnblock.php b/includes/api/ApiUnblock.php index 3aad8f4199..5cef194f36 100644 --- a/includes/api/ApiUnblock.php +++ b/includes/api/ApiUnblock.php @@ -20,6 +20,8 @@ * @file */ +use MediaWiki\Block\DatabaseBlock; + /** * API module that facilitates the unblocking of users. Requires API write mode * to be enabled. @@ -28,6 +30,8 @@ */ class ApiUnblock extends ApiBase { + use ApiBlockInfoTrait; + /** * Unblocks the specified user or provides the reason the unblock failed. */ @@ -48,7 +52,7 @@ class ApiUnblock extends ApiBase { $this->dieWithError( $status, null, - [ 'blockinfo' => ApiQueryUserInfo::getBlockInfo( $block ) ] + [ 'blockinfo' => $this->getBlockDetails( $block ) ] ); } } @@ -76,14 +80,14 @@ class ApiUnblock extends ApiBase { 'Reason' => $params['reason'], 'Tags' => $params['tags'] ]; - $block = Block::newFromTarget( $data['Target'] ); + $block = DatabaseBlock::newFromTarget( $data['Target'] ); $retval = SpecialUnblock::processUnblock( $data, $this->getContext() ); if ( $retval !== true ) { $this->dieStatus( $this->errorArrayToStatus( $retval ) ); } $res['id'] = $block->getId(); - $target = $block->getType() == Block::TYPE_AUTO ? '' : $block->getTarget(); + $target = $block->getType() == DatabaseBlock::TYPE_AUTO ? '' : $block->getTarget(); $res['user'] = $target instanceof User ? $target->getName() : $target; $res['userid'] = $target instanceof User ? $target->getId() : 0; $res['reason'] = $params['reason'];