Index: trunk/phase3/includes/api/ApiQueryImageInfo.php |
— | — | @@ -197,8 +197,13 @@ |
198 | 198 | if ( isset( $prop['timestamp'] ) ) { |
199 | 199 | $vals['timestamp'] = wfTimestamp( TS_ISO_8601, $file->getTimestamp() ); |
200 | 200 | } |
201 | | - if ( isset( $prop['user'] ) ) { |
202 | | - $vals['user'] = $file->getUser(); |
| 201 | + if ( isset( $prop['user'] ) || isset( $prop['userid'] ) ) { |
| 202 | + |
| 203 | + if ( isset( $prop['user'] ) ) { |
| 204 | + $vals['user'] = $file->getUser(); |
| 205 | + } else if ( isset( $prop['userid'] ) ) { |
| 206 | + $vals['userid'] = $file->getUser( 'id' ); |
| 207 | + } |
203 | 208 | if ( !$file->getUser( 'id' ) ) { |
204 | 209 | $vals['anon'] = ''; |
205 | 210 | } |
— | — | @@ -323,6 +328,7 @@ |
324 | 329 | return array( |
325 | 330 | 'timestamp', |
326 | 331 | 'user', |
| 332 | + 'userid', |
327 | 333 | 'comment', |
328 | 334 | 'url', |
329 | 335 | 'size', |
— | — | @@ -342,7 +348,8 @@ |
343 | 349 | 'prop' => array( |
344 | 350 | 'What image information to get:', |
345 | 351 | ' timestamp - Adds timestamp for the uploaded version', |
346 | | - ' user - Adds user for uploaded the image version', |
| 352 | + ' user - Adds the user who uploaded the image version', |
| 353 | + ' userid - Add the user id that uploaded the image version', |
347 | 354 | ' comment - Comment on the version', |
348 | 355 | ' url - Gives URL to the image and the description page', |
349 | 356 | ' size - Adds the size of the image in bytes and the height and width', |
Index: trunk/phase3/includes/api/ApiQueryRevisions.php |
— | — | @@ -43,7 +43,8 @@ |
44 | 44 | } |
45 | 45 | |
46 | 46 | private $fld_ids = false, $fld_flags = false, $fld_timestamp = false, $fld_size = false, |
47 | | - $fld_comment = false, $fld_parsedcomment = false, $fld_user = false, $fld_content = false, $fld_tags = false; |
| 47 | + $fld_comment = false, $fld_parsedcomment = false, $fld_user = false, $fld_userid = false, |
| 48 | + $fld_content = false, $fld_tags = false; |
48 | 49 | |
49 | 50 | protected function getTokenFunctions() { |
50 | 51 | // tokenname => function |
— | — | @@ -149,6 +150,7 @@ |
150 | 151 | $this->fld_comment = isset ( $prop['comment'] ); |
151 | 152 | $this->fld_parsedcomment = isset ( $prop['parsedcomment'] ); |
152 | 153 | $this->fld_size = isset ( $prop['size'] ); |
| 154 | + $this->fld_userid = isset( $prop['userid'] ); |
153 | 155 | $this->fld_user = isset ( $prop['user'] ); |
154 | 156 | $this->token = $params['token']; |
155 | 157 | |
— | — | @@ -364,11 +366,16 @@ |
365 | 367 | $vals['minor'] = ''; |
366 | 368 | } |
367 | 369 | |
368 | | - if ( $this->fld_user ) { |
| 370 | + if ( $this->fld_user || $this->fld_userid ) { |
369 | 371 | if ( $revision->isDeleted( Revision::DELETED_USER ) ) { |
370 | 372 | $vals['userhidden'] = ''; |
371 | 373 | } else { |
372 | | - $vals['user'] = $revision->getUserText(); |
| 374 | + if ( $this->fld_user ) { |
| 375 | + $vals['user'] = $revision->getUserText(); |
| 376 | + } else { |
| 377 | + $user = User::newFromText( $revision->getUserText() ); |
| 378 | + $vals['userid'] = $user->getId(); |
| 379 | + } |
373 | 380 | if ( !$revision->getUser() ) { |
374 | 381 | $vals['anon'] = ''; |
375 | 382 | } |
— | — | @@ -502,6 +509,7 @@ |
503 | 510 | 'flags', |
504 | 511 | 'timestamp', |
505 | 512 | 'user', |
| 513 | + 'userid', |
506 | 514 | 'size', |
507 | 515 | 'comment', |
508 | 516 | 'parsedcomment', |
— | — | @@ -562,7 +570,8 @@ |
563 | 571 | ' ids - The ID of the revision', |
564 | 572 | ' flags - Revision flags (minor)', |
565 | 573 | ' timestamp - The timestamp of the revision', |
566 | | - ' user - Gives user to make the revision', |
| 574 | + ' user - User that made the revision', |
| 575 | + ' userid - User id of revision creator', |
567 | 576 | ' size - Length of the revision', |
568 | 577 | ' comment - Comment by the user for revision', |
569 | 578 | ' parsedcomment - Parsed comment by the user for the revision', |
Index: trunk/phase3/includes/api/ApiQueryAllUsers.php |
— | — | @@ -108,7 +108,10 @@ |
109 | 109 | |
110 | 110 | $this->addOption( 'LIMIT', $sqlLimit ); |
111 | 111 | |
112 | | - $this->addFields( 'u1.user_name' ); |
| 112 | + $this->addFields( array( |
| 113 | + 'u1.user_name', |
| 114 | + 'u1.user_id' |
| 115 | + ) ); |
113 | 116 | $this->addFieldsIf( 'u1.user_editcount', $fld_editcount ); |
114 | 117 | $this->addFieldsIf( 'u1.user_registration', $fld_registration ); |
115 | 118 | |
— | — | @@ -155,7 +158,10 @@ |
156 | 159 | |
157 | 160 | // Record new user's data |
158 | 161 | $lastUser = $row->user_name; |
159 | | - $lastUserData = array( 'name' => $lastUser ); |
| 162 | + $lastUserData = array( |
| 163 | + 'name' => $lastUser, |
| 164 | + 'userid' => $row->user_id, |
| 165 | + ); |
160 | 166 | if ( $fld_blockinfo && !is_null( $row->blocker_name ) ) { |
161 | 167 | $lastUserData['blockedby'] = $row->blocker_name; |
162 | 168 | $lastUserData['blockreason'] = $row->ipb_reason; |