50 $res = $dbw->newSelectQueryBuilder()
53 ->where( [ $dbw->expr(
'user_id',
'>', $lastId ),
'user_registration' =>
null ] )
54 ->orderBy(
'user_id' )
56 ->caller( __METHOD__ )->fetchResultSet();
58 foreach ( $res as $row ) {
64 $userIdentity = $actorStore->getUserIdentityByUserId( $id );
65 if ( !$userIdentity ) {
69 $timestamp = $dbw->newSelectQueryBuilder()
70 ->select(
'MIN(rev_timestamp)' )
72 ->where( [
'rev_actor' => $userIdentity->getId() ] )
73 ->caller( __METHOD__ )->fetchField();
76 if ( $timestamp !==
null ) {
77 $dbw->newUpdateQueryBuilder()
79 ->set( [
'user_registration' => $timestamp ] )
80 ->where( [
'user_id' => $id ] )
81 ->caller( __METHOD__ )->execute();
83 $user = User::newFromId( $id );
84 $user->invalidateCache();
85 $this->
output(
"Set registration for #$id to $timestamp\n" );
87 $this->
output(
"Could not find registration for #$id NULL\n" );
90 $this->
output(
"Waiting for replica DBs..." );
92 $this->
output(
" done.\n" );
93 }
while ( $res->numRows() >= $this->getBatchSize() );