r47470 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r47469‎ | r47470 | r47471 >
Date:22:31, 18 February 2009
Author:catrope
Status:ok (Comments)
Tags:
Comment:
API: (bug 17561) Recommit r44231 ("Added usprop=emailable to list=users"), which was accidentally undone by r46845
Modified paths:
  • /trunk/phase3/includes/api/ApiQueryUsers.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryUsers.php
@@ -101,20 +101,24 @@
102102 $data = array();
103103 $res = $this->select(__METHOD__);
104104 while(($r = $db->fetchObject($res))) {
105 - $data[$r->user_name]['name'] = $r->user_name;
 105+ $user = User::newFromRow($r);
 106+ $name = $user->getName();
 107+ $data[$name]['name'] = $name;
106108 if(isset($this->prop['editcount']))
107 - $data[$r->user_name]['editcount'] = $r->user_editcount;
 109+ // No proper member function in the User class for this
 110+ $data[$name]['editcount'] = $r->user_editcount;
108111 if(isset($this->prop['registration']))
109 - $data[$r->user_name]['registration'] = wfTimestampOrNull(TS_ISO_8601, $r->user_registration);
110 - if(isset($this->prop['groups']))
 112+ // Nor for this one
 113+ $data[$name]['registration'] = wfTimestampOrNull(TS_ISO_8601, $r->user_registration);
 114+ if(isset($this->prop['groups']) && !is_null($r->ug_group))
111115 // This row contains only one group, others will be added from other rows
112 - if(!is_null($r->ug_group))
113 - $data[$r->user_name]['groups'][] = $r->ug_group;
114 - if(isset($this->prop['blockinfo']))
115 - if(!is_null($r->blocker_name)) {
116 - $data[$r->user_name]['blockedby'] = $r->blocker_name;
117 - $data[$r->user_name]['blockreason'] = $r->ipb_reason;
118 - }
 116+ $data[$name]['groups'][] = $r->ug_group;
 117+ if(isset($this->prop['blockinfo']) && !is_null($r->blocker_name)) {
 118+ $data[$name]['blockedby'] = $r->blocker_name;
 119+ $data[$name]['blockreason'] = $r->ipb_reason;
 120+ }
 121+ if(isset($this->prop['emailable']) && $user->canReceiveEmail())
 122+ $data[$name]['emailable'] = '';
119123 }
120124 }
121125 // Second pass: add result data to $retval

Follow-up revisions

RevisionCommit summaryAuthorDate
r47611API: Fix up r47470: User::newFromRow() needs all rows from the User table. Th...catrope12:44, 21 February 2009

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r44231API: Recommit r44182 (Added usprop=canemail to list=users) and rename canemai...catrope14:42, 4 December 2008
r46845* API: BREAKING CHANGE: (bug 11430) Return fewer results than the limit in so...catrope14:30, 5 February 2009

Comments

#Comment by Catrope (talk | contribs)   12:55, 21 February 2009

Fixed in r47611

Status & tagging log