Merge "Update .mailmap for the generation of CREDITS"
[lhc/web/wiklou.git] / includes / api / ApiQueryUserInfo.php
index d3cd0c4..7bc00cb 100644 (file)
@@ -64,18 +64,19 @@ class ApiQueryUserInfo extends ApiQueryBase {
         *  - blockreason - reason provided for the block
         *  - blockedtimestamp - timestamp for when the block was placed/modified
         *  - blockexpiry - expiry time of the block
+        *  - systemblocktype - system block type, if any
         */
        public static function getBlockInfo( Block $block ) {
-               global $wgContLang;
                $vals = [];
                $vals['blockid'] = $block->getId();
                $vals['blockedby'] = $block->getByName();
                $vals['blockedbyid'] = $block->getBy();
                $vals['blockreason'] = $block->mReason;
                $vals['blockedtimestamp'] = wfTimestamp( TS_ISO_8601, $block->mTimestamp );
-               $vals['blockexpiry'] = $wgContLang->formatExpiry(
-                       $block->getExpiry(), TS_ISO_8601, 'infinite'
-               );
+               $vals['blockexpiry'] = ApiResult::formatExpiry( $block->getExpiry(), 'infinite' );
+               if ( $block->getSystemBlockType() !== null ) {
+                       $vals['systemblocktype'] = $block->getSystemBlockType();
+               }
                return $vals;
        }
 
@@ -170,8 +171,13 @@ class ApiQueryUserInfo extends ApiQueryBase {
 
                if ( isset( $this->prop['preferencestoken'] ) ) {
                        $p = $this->getModulePrefix();
-                       $this->setWarning(
-                               "{$p}prop=preferencestoken has been deprecated. Please use action=query&meta=tokens instead."
+                       $this->addDeprecation(
+                               [
+                                       'apiwarn-deprecation-withreplacement',
+                                       "{$p}prop=preferencestoken",
+                                       'action=query&meta=tokens',
+                               ],
+                               "meta=userinfo&{$p}prop=preferencestoken"
                        );
                }
                if ( isset( $this->prop['preferencestoken'] ) &&