From: Sam Reed Date: Mon, 21 Feb 2011 19:48:15 +0000 (+0000) Subject: * (bug 27616) Add userid of blocked user and blocker to list=blocks X-Git-Tag: 1.31.0-rc.0~31840 X-Git-Url: http://git.cyclocoop.org/?a=commitdiff_plain;h=b73c12cf458269f0984901cddc10ae2d53e84d01;p=lhc%2Fweb%2Fwiklou.git * (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 --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 81147ad439..3ef39c06e9 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -178,6 +178,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN prop=info&inprop=displaytitle * (bug 27554) Update api information text to reflect change in bug 26125 * (bug 27611) list=blocks: Use ipb_by_text instead of join with user table +* (bug 27616) Add userid of blocked user and blocker to list=blocks === Languages updated in 1.18 === diff --git a/includes/api/ApiQueryBlocks.php b/includes/api/ApiQueryBlocks.php index 80940d5fa1..477d979dc6 100644 --- a/includes/api/ApiQueryBlocks.php +++ b/includes/api/ApiQueryBlocks.php @@ -36,7 +36,10 @@ if ( !defined( 'MEDIAWIKI' ) ) { */ class ApiQueryBlocks extends ApiQueryBase { - var $users; + /** + * @var Array + */ + protected $usernames; public function __construct( $query, $moduleName ) { parent::__construct( $query, $moduleName, 'bk' ); @@ -53,7 +56,9 @@ class ApiQueryBlocks extends ApiQueryBase { $prop = array_flip( $params['prop'] ); $fld_id = isset( $prop['id'] ); $fld_user = isset( $prop['user'] ); + $fld_userid = isset( $prop['userid'] ); $fld_by = isset( $prop['by'] ); + $fld_byid = isset( $prop['byid'] ); $fld_timestamp = isset( $prop['timestamp'] ); $fld_expiry = isset( $prop['expiry'] ); $fld_reason = isset( $prop['reason'] ); @@ -68,12 +73,15 @@ class ApiQueryBlocks extends ApiQueryBase { if ( $fld_id ) { $this->addFields( 'ipb_id' ); } - if ( $fld_user ) { + if ( $fld_user || $fld_userid ) { $this->addFields( array( 'ipb_address', 'ipb_user' ) ); } if ( $fld_by ) { $this->addFields( 'ipb_by_text' ); } + if ( $fld_byid ) { + $this->addFields( 'ipb_by' ); + } if ( $fld_timestamp ) { $this->addFields( 'ipb_timestamp' ); } @@ -149,9 +157,15 @@ class ApiQueryBlocks extends ApiQueryBase { if ( $fld_user && !$row->ipb_auto ) { $block['user'] = $row->ipb_address; } + if ( $fld_userid && !$row->ipb_auto ) { + $block['userid'] = $row->ipb_user; + } if ( $fld_by ) { $block['by'] = $row->ipb_by_text; } + if ( $fld_byid ) { + $block['byid'] = $row->ipb_by; + } if ( $fld_timestamp ) { $block['timestamp'] = wfTimestamp( TS_ISO_8601, $row->ipb_timestamp ); } @@ -246,7 +260,9 @@ class ApiQueryBlocks extends ApiQueryBase { ApiBase::PARAM_TYPE => array( 'id', 'user', + 'userid', 'by', + 'byid', 'timestamp', 'expiry', 'reason', @@ -272,7 +288,9 @@ class ApiQueryBlocks extends ApiQueryBase { 'Which properties to get', ' id - Adds the ID of the block', ' user - Adds the username of the blocked user', - ' by - Adds the username of the blocking admin', + ' userid - Adds the user ID of the blocked user', + ' by - Adds the username of the blocking user', + ' byid - Adds the user ID of the blocking user', ' timestamp - Adds the timestamp of when the block was given', ' expiry - Adds the timestamp of when the block expires', ' reason - Adds the reason given for the block',