50 foreach ( $users as $user ) {
51 $wikiId = $user->getWikiId();
53 if ( $wikiToQuery ===
null ) {
54 $wikiToQuery = $wikiId;
55 } elseif ( $wikiToQuery !== $wikiId ) {
56 throw new InvalidArgumentException(
'All queried users must belong to the same wiki.' );
60 $timestampsById[$user->getId( $wikiId )] =
null;
63 if ( $wikiToQuery ===
null ) {
68 $batches = array_chunk( array_keys( $timestampsById ), 1_000 );
70 $dbr = $this->connectionProvider->getReplicaDatabase( $wikiToQuery );
72 foreach ( $batches as $userIdBatch ) {
73 $res = $dbr->newSelectQueryBuilder()
74 ->select( [
'user_id',
'user_registration' ] )
76 ->where( [
'user_id' => $userIdBatch ] )
77 ->caller( __METHOD__ )
80 foreach ( $res as $row ) {
81 $timestampsById[$row->user_id] =
wfTimestampOrNull( TS::MW, $row->user_registration );
85 return $timestampsById;