Follow-up r77796: a couple of typos in the comment, and break more consistently at...
[lhc/web/wiklou.git] / includes / UserArray.php
index 27847e6..d48a444 100644 (file)
@@ -12,6 +12,17 @@ abstract class UserArray implements Iterator {
                return $userArray;
        }
 
+       static function newFromIDs( $ids ) {
+               $ids = array_map( 'intval', (array)$ids ); // paranoia
+               if ( !$ids )
+                       // Database::select() doesn't like empty arrays
+                       return new ArrayIterator(array());
+               $dbr = wfGetDB( DB_SLAVE );
+               $res = $dbr->select( 'user', '*', array( 'user_id' => $ids ),
+                       __METHOD__ );
+               return self::newFromResult( $res );
+       }
+
        protected static function newFromResult_internal( $res ) {
                $userArray = new UserArrayFromResult( $res );
                return $userArray;
@@ -36,6 +47,10 @@ class UserArrayFromResult extends UserArray {
                }
        }
 
+       public function count() {
+               return $this->res->numRows();
+       }
+
        function current() {
                return $this->current;
        }