diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-01 15:32:59 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-01 15:32:59 -0400 |
commit | 6dc1997577fab2c366781fd7048144935afa0012 (patch) | |
tree | 8918d28c7ab4342f0738985e37af1dfc42d0e93a /includes/api/ApiBlock.php | |
parent | 150f94f051128f367bc89f6b7e5f57eb2a69fc62 (diff) | |
parent | fa89acd685cb09cdbe1c64cbb721ec64975bbbc1 (diff) |
Merge commit 'fa89acd'
# Conflicts:
# .gitignore
# extensions/ArchInterWiki.sql
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 |