* @param $caller String: the calling method
*/
public function doQuery( $users, $caller = '' ) {
- if ( count( $users ) === 0 ) {
- return false;
- }
+ $default = $this->getDefault();
foreach ( (array) $users as $index => $value ) {
- $users[$index] = strtr( $value, '_', ' ' );
+ $name = strtr( $value, '_', ' ' );
+ if ( isset( $this->cache[$name] ) ) {
+ // Skip users whose gender setting we already know
+ unset( $users[$index] );
+ } else {
+ $users[$index] = $name;
+ // For existing users, this value will be overwritten by the correct value
+ $this->cache[$name] = $default;
+ }
+ }
+
+ if ( count( $users ) === 0 ) {
+ return false;
}
$dbr = wfGetDB( DB_SLAVE );
}
$res = $dbr->select( $table, $fields, $conds, $comment, $joins, $joins );
- $default = $this->getDefault();
foreach ( $res as $row ) {
$this->cache[$row->user_name] = $row->up_value ? $row->up_value : $default;
}