* (bug 27611) list=blocks: Use ipb_by_text instead of join with user table

Save a table join when looking up blocks (yay!)

Minor issue, for blocks where users have been renamed, we get their old name (Not a big deal IMHO)
This commit is contained in:
Sam Reed 2011-02-21 19:34:57 +00:00
parent bbeb11c616
commit 67a4be4866
2 changed files with 3 additions and 4 deletions

View file

@ -177,6 +177,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
* (bug 27479) API error when using both prop=pageprops and
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
=== Languages updated in 1.18 ===

View file

@ -72,9 +72,7 @@ class ApiQueryBlocks extends ApiQueryBase {
$this->addFields( array( 'ipb_address', 'ipb_user' ) );
}
if ( $fld_by ) {
$this->addTables( 'user' );
$this->addFields( array( 'ipb_by', 'user_name' ) );
$this->addWhere( 'user_id = ipb_by' );
$this->addFields( 'ipb_by_text' );
}
if ( $fld_timestamp ) {
$this->addFields( 'ipb_timestamp' );
@ -152,7 +150,7 @@ class ApiQueryBlocks extends ApiQueryBase {
$block['user'] = $row->ipb_address;
}
if ( $fld_by ) {
$block['by'] = $row->user_name;
$block['by'] = $row->ipb_by_text;
}
if ( $fld_timestamp ) {
$block['timestamp'] = wfTimestamp( TS_ISO_8601, $row->ipb_timestamp );