* (bug 27611) list=blocks: Use ipb_by_text instead of join with user table
authorSam Reed <reedy@users.mediawiki.org>
Mon, 21 Feb 2011 19:34:57 +0000 (19:34 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Mon, 21 Feb 2011 19:34:57 +0000 (19:34 +0000)
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)

RELEASE-NOTES
includes/api/ApiQueryBlocks.php

index 5aaffaa..81147ad 100644 (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 ===
 
index 1563f48..80940d5 100644 (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 );