summaryrefslogtreecommitdiff
path: root/includes/api/ApiBlock.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/api/ApiBlock.php')
-rw-r--r--includes/api/ApiBlock.php16
1 files changed, 11 insertions, 5 deletions
diff --git a/includes/api/ApiBlock.php b/includes/api/ApiBlock.php
index 4d39ce1b..6adfc1a0 100644
--- a/includes/api/ApiBlock.php
+++ b/includes/api/ApiBlock.php
@@ -39,6 +39,8 @@ class ApiBlock extends ApiBase {
* of success. If it fails, the result will specify the nature of the error.
*/
public function execute() {
+ global $wgContLang;
+
$user = $this->getUser();
$params = $this->extractRequestParams();
@@ -50,7 +52,13 @@ class ApiBlock extends ApiBase {
if ( $user->isBlocked() ) {
$status = SpecialBlock::checkUnblockSelf( $params['user'], $user );
if ( $status !== true ) {
- $this->dieUsageMsg( array( $status ) );
+ $msg = $this->parseMsg( $status );
+ $this->dieUsage(
+ $msg['info'],
+ $msg['code'],
+ 0,
+ array( 'blockinfo' => ApiQueryUserInfo::getBlockInfo( $user->getBlock() ) )
+ );
}
}
@@ -100,11 +108,9 @@ class ApiBlock extends ApiBase {
$res['user'] = $params['user'];
$res['userID'] = $target instanceof User ? $target->getId() : 0;
- $block = Block::newFromTarget( $target );
+ $block = Block::newFromTarget( $target, null, true );
if ( $block instanceof Block ) {
- $res['expiry'] = $block->mExpiry == $this->getDB()->getInfinity()
- ? 'infinite'
- : wfTimestamp( TS_ISO_8601, $block->mExpiry );
+ $res['expiry'] = $wgContLang->formatExpiry( $block->mExpiry, TS_ISO_8601, 'infinite' );
$res['id'] = $block->getId();
} else {
# should be unreachable