49 foreach ( $users as $user ) {
50 $wikiId = $user->getWikiId();
52 if ( $wikiToQuery ===
null ) {
53 $wikiToQuery = $wikiId;
54 } elseif ( $wikiToQuery !== $wikiId ) {
55 throw new InvalidArgumentException(
'All queried users must belong to the same wiki.' );
59 $timestampsById[$user->getId( $wikiId )] =
null;
62 if ( $wikiToQuery ===
null ) {
67 $batches = array_chunk( array_keys( $timestampsById ), 1_000 );
69 $dbr = $this->connectionProvider->getReplicaDatabase( $wikiToQuery );
71 foreach ( $batches as $userIdBatch ) {
72 $res = $dbr->newSelectQueryBuilder()
73 ->select( [
'user_id',
'user_registration' ] )
75 ->where( [
'user_id' => $userIdBatch ] )
76 ->caller( __METHOD__ )
79 foreach ( $res as $row ) {
80 $timestampsById[$row->user_id] =
wfTimestampOrNull( TS_MW, $row->user_registration );
84 return $timestampsById;