* @file
*/
+use MediaWiki\MediaWikiServices;
+
/**
* Query module to get information about the currently logged-in user
*
* - 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;
}
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'] ) &&
}
if ( isset( $this->prop['unreadcount'] ) ) {
- $unreadNotifications = WatchedItemStore::getDefaultInstance()->countUnreadNotifications(
+ $store = MediaWikiServices::getInstance()->getWatchedItemStore();
+ $unreadNotifications = $store->countUnreadNotifications(
$user,
self::WL_UNREAD_LIMIT
);