diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2015-12-20 09:00:55 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2015-12-20 09:00:55 +0100 |
commit | a2190ac74dd4d7080b12bab90e552d7aa81209ef (patch) | |
tree | 8b31f38de9882d18df54cf8d9e0de74167a094eb /includes/api/ApiBlock.php | |
parent | 15e69f7b20b6596b9148030acce5b59993b95a45 (diff) | |
parent | 257401d8b2cf661adf36c84b0e3fd1cf85e33c22 (diff) |
Merge branch 'mw-1.26'
Diffstat (limited to 'includes/api/ApiBlock.php')
-rw-r--r-- | includes/api/ApiBlock.php | 16 |
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 |