r82570 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r82569‎ | r82570 | r82571 >
Date:19:48, 21 February 2011
Author:reedy
Status:ok
Tags:
Comment:
* (bug 27616) Add userid of blocked user and blocker to list=blocks

Also tweak comment about "blocking admin". Non admins can block if they have the right... Sooo, "user" is more appropriate
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryBlocks.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryBlocks.php
@@ -36,7 +36,10 @@
3737 */
3838 class ApiQueryBlocks extends ApiQueryBase {
3939
40 - var $users;
 40+ /**
 41+ * @var Array
 42+ */
 43+ protected $usernames;
4144
4245 public function __construct( $query, $moduleName ) {
4346 parent::__construct( $query, $moduleName, 'bk' );
@@ -53,7 +56,9 @@
5457 $prop = array_flip( $params['prop'] );
5558 $fld_id = isset( $prop['id'] );
5659 $fld_user = isset( $prop['user'] );
 60+ $fld_userid = isset( $prop['userid'] );
5761 $fld_by = isset( $prop['by'] );
 62+ $fld_byid = isset( $prop['byid'] );
5863 $fld_timestamp = isset( $prop['timestamp'] );
5964 $fld_expiry = isset( $prop['expiry'] );
6065 $fld_reason = isset( $prop['reason'] );
@@ -68,12 +73,15 @@
6974 if ( $fld_id ) {
7075 $this->addFields( 'ipb_id' );
7176 }
72 - if ( $fld_user ) {
 77+ if ( $fld_user || $fld_userid ) {
7378 $this->addFields( array( 'ipb_address', 'ipb_user' ) );
7479 }
7580 if ( $fld_by ) {
7681 $this->addFields( 'ipb_by_text' );
7782 }
 83+ if ( $fld_byid ) {
 84+ $this->addFields( 'ipb_by' );
 85+ }
7886 if ( $fld_timestamp ) {
7987 $this->addFields( 'ipb_timestamp' );
8088 }
@@ -149,9 +157,15 @@
150158 if ( $fld_user && !$row->ipb_auto ) {
151159 $block['user'] = $row->ipb_address;
152160 }
 161+ if ( $fld_userid && !$row->ipb_auto ) {
 162+ $block['userid'] = $row->ipb_user;
 163+ }
153164 if ( $fld_by ) {
154165 $block['by'] = $row->ipb_by_text;
155166 }
 167+ if ( $fld_byid ) {
 168+ $block['byid'] = $row->ipb_by;
 169+ }
156170 if ( $fld_timestamp ) {
157171 $block['timestamp'] = wfTimestamp( TS_ISO_8601, $row->ipb_timestamp );
158172 }
@@ -246,7 +260,9 @@
247261 ApiBase::PARAM_TYPE => array(
248262 'id',
249263 'user',
 264+ 'userid',
250265 'by',
 266+ 'byid',
251267 'timestamp',
252268 'expiry',
253269 'reason',
@@ -272,7 +288,9 @@
273289 'Which properties to get',
274290 ' id - Adds the ID of the block',
275291 ' user - Adds the username of the blocked user',
276 - ' by - Adds the username of the blocking admin',
 292+ ' userid - Adds the user ID of the blocked user',
 293+ ' by - Adds the username of the blocking user',
 294+ ' byid - Adds the user ID of the blocking user',
277295 ' timestamp - Adds the timestamp of when the block was given',
278296 ' expiry - Adds the timestamp of when the block expires',
279297 ' reason - Adds the reason given for the block',
Index: trunk/phase3/RELEASE-NOTES
@@ -178,6 +178,7 @@
179179 prop=info&inprop=displaytitle
180180 * (bug 27554) Update api information text to reflect change in bug 26125
181181 * (bug 27611) list=blocks: Use ipb_by_text instead of join with user table
 182+* (bug 27616) Add userid of blocked user and blocker to list=blocks
182183
183184 === Languages updated in 1.18 ===
184185

Status & tagging log