Index: trunk/phase3/includes/api/ApiQueryUsers.php |
— | — | @@ -73,10 +73,8 @@ |
74 | 74 | |
75 | 75 | $db = $this->getDB(); |
76 | 76 | $this->addTables('user', 'u1'); |
77 | | - $this->addFields('u1.user_name'); |
| 77 | + $this->addFields('u1.*'); |
78 | 78 | $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'])); |
81 | 79 | |
82 | 80 | if(isset($this->prop['groups'])) { |
83 | 81 | $this->addTables('user_groups'); |
— | — | @@ -96,20 +94,26 @@ |
97 | 95 | $data = array(); |
98 | 96 | $res = $this->select(__METHOD__); |
99 | 97 | 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; |
101 | 101 | 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; |
103 | 104 | 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); |
105 | 107 | if(isset($this->prop['groups'])) |
106 | 108 | // This row contains only one group, others will be added from other rows |
107 | 109 | if(!is_null($r->ug_group)) |
108 | | - $data[$r->user_name]['groups'][] = $r->ug_group; |
| 110 | + $data[$name]['groups'][] = $r->ug_group; |
109 | 111 | if(isset($this->prop['blockinfo'])) |
110 | 112 | 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; |
113 | 115 | } |
| 116 | + if(isset($this->prop['emailable']) && $user->canReceiveEmail()) |
| 117 | + $data[$name]['emailable'] = ''; |
114 | 118 | } |
115 | 119 | |
116 | 120 | // Second pass: add result data to $retval |
— | — | @@ -134,7 +138,8 @@ |
135 | 139 | 'blockinfo', |
136 | 140 | 'groups', |
137 | 141 | 'editcount', |
138 | | - 'registration' |
| 142 | + 'registration', |
| 143 | + 'emailable', |
139 | 144 | ) |
140 | 145 | ), |
141 | 146 | 'users' => array( |
— | — | @@ -147,9 +152,11 @@ |
148 | 153 | return array ( |
149 | 154 | 'prop' => array( |
150 | 155 | '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]]', |
154 | 161 | ), |
155 | 162 | 'users' => 'A list of users to obtain the same information for' |
156 | 163 | ); |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -480,6 +480,7 @@ |
481 | 481 | * (bug 16421) Made list=logevents's leuser accept user names with underscores |
482 | 482 | instead of spaces |
483 | 483 | * (bug 16516) Made rvsection=T-2 work |
| 484 | +* (bug 16526) Added usprop=emailable to list=users |
484 | 485 | * (bug 16548) list=search threw errors with an invalid error code |
485 | 486 | |
486 | 487 | === Languages updated in 1.14 === |