r44231 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44230‎ | r44231 | r44232 >
Date:14:42, 4 December 2008
Author:catrope
Status:ok
Tags:
Comment:
API: Recommit r44182 (Added usprop=canemail to list=users) and rename canemail to emailable
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryUsers.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryUsers.php
@@ -73,10 +73,8 @@
7474
7575 $db = $this->getDB();
7676 $this->addTables('user', 'u1');
77 - $this->addFields('u1.user_name');
 77+ $this->addFields('u1.*');
7878 $this->addWhereFld('u1.user_name', $goodNames);
79 - $this->addFieldsIf('u1.user_editcount', isset($this->prop['editcount']));
80 - $this->addFieldsIf('u1.user_registration', isset($this->prop['registration']));
8179
8280 if(isset($this->prop['groups'])) {
8381 $this->addTables('user_groups');
@@ -96,20 +94,26 @@
9795 $data = array();
9896 $res = $this->select(__METHOD__);
9997 while(($r = $db->fetchObject($res))) {
100 - $data[$r->user_name]['name'] = $r->user_name;
 98+ $user = User::newFromRow($r);
 99+ $name = $user->getName();
 100+ $data[$name]['name'] = $name;
101101 if(isset($this->prop['editcount']))
102 - $data[$r->user_name]['editcount'] = $r->user_editcount;
 102+ // No proper member function in User class for this
 103+ $data[$name]['editcount'] = $r->user_editcount;
103104 if(isset($this->prop['registration']))
104 - $data[$r->user_name]['registration'] = wfTimestampOrNull(TS_ISO_8601, $r->user_registration);
 105+ // Nor for this one
 106+ $data[$name]['registration'] = wfTimestampOrNull(TS_ISO_8601, $r->user_registration);
105107 if(isset($this->prop['groups']))
106108 // This row contains only one group, others will be added from other rows
107109 if(!is_null($r->ug_group))
108 - $data[$r->user_name]['groups'][] = $r->ug_group;
 110+ $data[$name]['groups'][] = $r->ug_group;
109111 if(isset($this->prop['blockinfo']))
110112 if(!is_null($r->blocker_name)) {
111 - $data[$r->user_name]['blockedby'] = $r->blocker_name;
112 - $data[$r->user_name]['blockreason'] = $r->ipb_reason;
 113+ $data[$name]['blockedby'] = $r->blocker_name;
 114+ $data[$name]['blockreason'] = $r->ipb_reason;
113115 }
 116+ if(isset($this->prop['emailable']) && $user->canReceiveEmail())
 117+ $data[$name]['emailable'] = '';
114118 }
115119
116120 // Second pass: add result data to $retval
@@ -134,7 +138,8 @@
135139 'blockinfo',
136140 'groups',
137141 'editcount',
138 - 'registration'
 142+ 'registration',
 143+ 'emailable',
139144 )
140145 ),
141146 'users' => array(
@@ -147,9 +152,11 @@
148153 return array (
149154 'prop' => array(
150155 'What pieces of information to include',
151 - ' blockinfo - tags if the user is blocked, by whom, and for what reason',
152 - ' groups - lists all the groups the user belongs to',
153 - ' editcount - adds the user\'s edit count'
 156+ ' blockinfo - tags if the user is blocked, by whom, and for what reason',
 157+ ' groups - lists all the groups the user belongs to',
 158+ ' editcount - adds the user\'s edit count',
 159+ ' registration - adds the user\'s registration timestamp',
 160+ ' emailable - tags if the user can and wants to receive e-mail through [[Special:Emailuser]]',
154161 ),
155162 'users' => 'A list of users to obtain the same information for'
156163 );
Index: trunk/phase3/RELEASE-NOTES
@@ -480,6 +480,7 @@
481481 * (bug 16421) Made list=logevents's leuser accept user names with underscores
482482 instead of spaces
483483 * (bug 16516) Made rvsection=T-2 work
 484+* (bug 16526) Added usprop=emailable to list=users
484485 * (bug 16548) list=search threw errors with an invalid error code
485486
486487 === Languages updated in 1.14 ===

Follow-up revisions

RevisionCommit summaryAuthorDate
r47470API: (bug 17561) Recommit r44231 ("Added usprop=emailable to list=users"), wh...catrope22:31, 18 February 2009

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r44182* API: (bug 16526) Added usprop=canemail to list=users, which tells whether a...catrope19:07, 3 December 2008

Status & tagging log