UserArray: Avoid * and double keys in select
authorumherirrender <umherirrender_de.wp@web.de>
Sat, 30 Nov 2013 00:57:58 +0000 (01:57 +0100)
committerIAlex <codereview@emsenhuber.ch>
Sat, 14 Dec 2013 14:51:42 +0000 (14:51 +0000)
Use User::selectFields to get all fields instead of *,
also use array_unqiue to make the sql nicer by having only single value
in the IN statement.

Change-Id: I0a4888be20f84f2955e82ced621aed526cc83f20

includes/UserArray.php

index 12b779e..90d1134 100644 (file)
@@ -47,8 +47,12 @@ abstract class UserArray implements Iterator {
                        return new ArrayIterator( array() );
                }
                $dbr = wfGetDB( DB_SLAVE );
-               $res = $dbr->select( 'user', '*', array( 'user_id' => $ids ),
-                       __METHOD__ );
+               $res = $dbr->select(
+                       'user',
+                       User::selectFields(),
+                       array( 'user_id' => array_unique( $ids ) ),
+                       __METHOD__
+               );
                return self::newFromResult( $res );
        }