From 63601400e476c6cf43d985f3e7b9864681695ed4 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Fri, 18 Jan 2013 16:46:04 +0100 Subject: Update to MediaWiki 1.20.2 this update includes: * adjusted Arch Linux skin * updated FluxBBAuthPlugin * patch for https://bugzilla.wikimedia.org/show_bug.cgi?id=44024 --- includes/api/ApiQueryUserInfo.php | 74 ++++++++++++++++++++++++++++++++++----- 1 file changed, 66 insertions(+), 8 deletions(-) (limited to 'includes/api/ApiQueryUserInfo.php') diff --git a/includes/api/ApiQueryUserInfo.php b/includes/api/ApiQueryUserInfo.php index a0ee227f..66906659 100644 --- a/includes/api/ApiQueryUserInfo.php +++ b/includes/api/ApiQueryUserInfo.php @@ -4,7 +4,7 @@ * * Created on July 30, 2007 * - * Copyright © 2007 Yuri Astrakhan @gmail.com + * Copyright © 2007 Yuri Astrakhan "@gmail.com" * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -50,7 +50,7 @@ class ApiQueryUserInfo extends ApiQueryBase { } protected function getCurrentUserInfo() { - global $wgRequest, $wgHiddenPrefs; + global $wgHiddenPrefs; $user = $this->getUser(); $result = $this->getResult(); $vals = array(); @@ -63,7 +63,10 @@ class ApiQueryUserInfo extends ApiQueryBase { if ( isset( $this->prop['blockinfo'] ) ) { if ( $user->isBlocked() ) { - $vals['blockedby'] = User::whoIs( $user->blockedBy() ); + $block = $user->getBlock(); + $vals['blockid'] = $block->getId(); + $vals['blockedby'] = $block->getByName(); + $vals['blockedbyid'] = $block->getBy(); $vals['blockreason'] = $user->blockedFor(); } } @@ -73,14 +76,12 @@ class ApiQueryUserInfo extends ApiQueryBase { } if ( isset( $this->prop['groups'] ) ) { - $autolist = ApiQueryUsers::getAutoGroups( $user ); - - $vals['groups'] = array_merge( $autolist, $user->getGroups() ); + $vals['groups'] = $user->getEffectiveGroups(); $result->setIndexedTagName( $vals['groups'], 'g' ); // even if empty } if ( isset( $this->prop['implicitgroups'] ) ) { - $vals['implicitgroups'] = ApiQueryUsers::getAutoGroups( $user ); + $vals['implicitgroups'] = $user->getAutomaticGroups(); $result->setIndexedTagName( $vals['implicitgroups'], 'g' ); // even if empty } @@ -136,7 +137,7 @@ class ApiQueryUserInfo extends ApiQueryBase { } if ( isset( $this->prop['acceptlang'] ) ) { - $langs = $wgRequest->getAcceptLang(); + $langs = $this->getRequest()->getAcceptLang(); $acceptLang = array(); foreach ( $langs as $lang => $val ) { $r = array( 'q' => $val ); @@ -231,6 +232,63 @@ class ApiQueryUserInfo extends ApiQueryBase { ); } + public function getResultProperties() { + return array( + ApiBase::PROP_LIST => false, + '' => array( + 'id' => 'integer', + 'name' => 'string', + 'anon' => 'boolean' + ), + 'blockinfo' => array( + 'blockid' => array( + ApiBase::PROP_TYPE => 'integer', + ApiBase::PROP_NULLABLE => true + ), + 'blockedby' => array( + ApiBase::PROP_TYPE => 'string', + ApiBase::PROP_NULLABLE => true + ), + 'blockedbyid' => array( + ApiBase::PROP_TYPE => 'integer', + ApiBase::PROP_NULLABLE => true + ), + 'blockedreason' => array( + ApiBase::PROP_TYPE => 'string', + ApiBase::PROP_NULLABLE => true + ) + ), + 'hasmsg' => array( + 'messages' => 'boolean' + ), + 'preferencestoken' => array( + 'preferencestoken' => 'string' + ), + 'editcount' => array( + 'editcount' => 'integer' + ), + 'realname' => array( + 'realname' => array( + ApiBase::PROP_TYPE => 'string', + ApiBase::PROP_NULLABLE => true + ) + ), + 'email' => array( + 'email' => 'string', + 'emailauthenticated' => array( + ApiBase::PROP_TYPE => 'timestamp', + ApiBase::PROP_NULLABLE => true + ) + ), + 'registrationdate' => array( + 'registrationdate' => array( + ApiBase::PROP_TYPE => 'timestamp', + ApiBase::PROP_NULLABLE => true + ) + ) + ); + } + public function getDescription() { return 'Get information about the current user'; } -- cgit v1.2.3-54-g00ecf