110 public function doQuery( array $userIds, $options = [], $caller =
'' ) {
114 $userIds = array_unique( $userIds );
116 foreach ( $userIds as $userId ) {
117 $userId = (int)$userId;
118 if ( $userId <= 0 ) {
121 if ( isset( $this->cache[$userId][
'name'] ) ) {
122 $usersToCheck[$userId] = $this->cache[$userId][
'name'];
124 $usersToQuery[] = $userId;
129 if ( count( $usersToQuery ) ) {
130 $dbr = $this->dbProvider->getReplicaDatabase();
131 $queryBuilder = $dbr->newSelectQueryBuilder()
132 ->select( [
'user_name',
'user_real_name',
'user_registration',
'user_id',
'actor_id' ] )
134 ->join(
'actor',
null,
'actor_user = user_id' )
135 ->where( [
'user_id' => $usersToQuery ] );
137 $comment = __METHOD__;
138 if ( strval( $caller ) !==
'' ) {
139 $comment .=
"/$caller";
142 $res = $queryBuilder->caller( $comment )->fetchResultSet();
143 foreach ( $res as $row ) {
144 $userId = (int)$row->user_id;
145 $this->cache[$userId][
'name'] = $row->user_name;
146 $this->cache[$userId][
'real_name'] = $row->user_real_name;
147 $this->cache[$userId][
'registration'] = $row->user_registration;
148 $this->cache[$userId][
'actor'] = $row->actor_id;
149 $usersToCheck[$userId] = $row->user_name;
153 $lb = $this->linkBatchFactory->newLinkBatch();
154 foreach ( $usersToCheck as $userId => $name ) {
155 if ( $this->
queryNeeded( $userId,
'userpage', $options ) ) {
157 $this->typesCached[$userId][
'userpage'] = 1;
159 if ( $this->
queryNeeded( $userId,
'usertalk', $options ) ) {
161 $this->typesCached[$userId][
'usertalk'] = 1;