36 $res = $dbw->newSelectQueryBuilder()
39 ->where( [ $dbw->expr(
'user_id',
'>', $lastId ),
'user_registration' =>
null ] )
40 ->orderBy(
'user_id' )
42 ->caller( __METHOD__ )->fetchResultSet();
44 foreach ( $res as $row ) {
50 $userIdentity = $actorStore->getUserIdentityByUserId( $id );
51 if ( !$userIdentity ) {
55 $timestamp = $dbw->newSelectQueryBuilder()
56 ->select(
'MIN(rev_timestamp)' )
58 ->where( [
'rev_actor' => $userIdentity->getId() ] )
59 ->caller( __METHOD__ )->fetchField();
62 if ( $timestamp !==
null ) {
63 $dbw->newUpdateQueryBuilder()
65 ->set( [
'user_registration' => $timestamp ] )
66 ->where( [
'user_id' => $id ] )
67 ->caller( __METHOD__ )->execute();
69 $user = User::newFromId( $id );
70 $user->invalidateCache();
71 $this->
output(
"Set registration for #$id to $timestamp\n" );
73 $this->
output(
"Could not find registration for #$id NULL\n" );
76 $this->
output(
"Waiting for replica DBs..." );
78 $this->
output(
" done.\n" );
79 }
while ( $res->numRows() >= $this->getBatchSize() );