summaryrefslogtreecommitdiff
path: root/includes/api/ApiQueryUsers.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2009-02-22 13:37:51 +0100
committerPierre Schmitz <pierre@archlinux.de>2009-02-22 13:37:51 +0100
commitb9b85843572bf283f48285001e276ba7e61b63f6 (patch)
tree4c6f4571552ada9ccfb4030481dcf77308f8b254 /includes/api/ApiQueryUsers.php
parentd9a20acc4e789cca747ad360d87ee3f3e7aa58c1 (diff)
updated to MediaWiki 1.14.0
Diffstat (limited to 'includes/api/ApiQueryUsers.php')
-rw-r--r--includes/api/ApiQueryUsers.php39
1 files changed, 23 insertions, 16 deletions
diff --git a/includes/api/ApiQueryUsers.php b/includes/api/ApiQueryUsers.php
index a8147567..e50d8d82 100644
--- a/includes/api/ApiQueryUsers.php
+++ b/includes/api/ApiQueryUsers.php
@@ -68,15 +68,13 @@ if (!defined('MEDIAWIKI')) {
else
$goodNames[] = $n;
}
- if(empty($goodNames))
+ if(!count($goodNames))
return $retval;
- $db = $this->getDb();
+ $db = $this->getDB();
$this->addTables('user', 'u1');
- $this->addFields('u1.user_name');
+ $this->addFields('u1.*');
$this->addWhereFld('u1.user_name', $goodNames);
- $this->addFieldsIf('u1.user_editcount', isset($this->prop['editcount']));
- $this->addFieldsIf('u1.user_registration', isset($this->prop['registration']));
if(isset($this->prop['groups'])) {
$this->addTables('user_groups');
@@ -96,20 +94,26 @@ if (!defined('MEDIAWIKI')) {
$data = array();
$res = $this->select(__METHOD__);
while(($r = $db->fetchObject($res))) {
- $data[$r->user_name]['name'] = $r->user_name;
+ $user = User::newFromRow($r);
+ $name = $user->getName();
+ $data[$name]['name'] = $name;
if(isset($this->prop['editcount']))
- $data[$r->user_name]['editcount'] = $r->user_editcount;
+ // No proper member function in User class for this
+ $data[$name]['editcount'] = $r->user_editcount;
if(isset($this->prop['registration']))
- $data[$r->user_name]['registration'] = wfTimestampOrNull(TS_ISO_8601, $r->user_registration);
+ // Nor for this one
+ $data[$name]['registration'] = wfTimestampOrNull(TS_ISO_8601, $r->user_registration);
if(isset($this->prop['groups']))
// This row contains only one group, others will be added from other rows
if(!is_null($r->ug_group))
- $data[$r->user_name]['groups'][] = $r->ug_group;
+ $data[$name]['groups'][] = $r->ug_group;
if(isset($this->prop['blockinfo']))
if(!is_null($r->blocker_name)) {
- $data[$r->user_name]['blockedby'] = $r->blocker_name;
- $data[$r->user_name]['blockreason'] = $r->ipb_reason;
+ $data[$name]['blockedby'] = $r->blocker_name;
+ $data[$name]['blockreason'] = $r->ipb_reason;
}
+ if(isset($this->prop['emailable']) && $user->canReceiveEmail())
+ $data[$name]['emailable'] = '';
}
// Second pass: add result data to $retval
@@ -134,7 +138,8 @@ if (!defined('MEDIAWIKI')) {
'blockinfo',
'groups',
'editcount',
- 'registration'
+ 'registration',
+ 'emailable',
)
),
'users' => array(
@@ -147,9 +152,11 @@ if (!defined('MEDIAWIKI')) {
return array (
'prop' => array(
'What pieces of information to include',
- ' blockinfo - tags if the user is blocked, by whom, and for what reason',
- ' groups - lists all the groups the user belongs to',
- ' editcount - adds the user\'s edit count'
+ ' blockinfo - tags if the user is blocked, by whom, and for what reason',
+ ' groups - lists all the groups the user belongs to',
+ ' editcount - adds the user\'s edit count',
+ ' registration - adds the user\'s registration timestamp',
+ ' emailable - tags if the user can and wants to receive e-mail through [[Special:Emailuser]]',
),
'users' => 'A list of users to obtain the same information for'
);
@@ -164,6 +171,6 @@ if (!defined('MEDIAWIKI')) {
}
public function getVersion() {
- return __CLASS__ . ': $Id: ApiQueryUsers.php 38183 2008-07-29 12:58:04Z rotem $';
+ return __CLASS__ . ': $Id: ApiQueryUsers.php 44231 2008-12-04 14:42:30Z catrope $';
}
}