- $this->output( "Creating actor entries for all registered users\n" );
- $end = 0;
- $dbw = $this->getDB( DB_MASTER );
- $max = $dbw->selectField( 'user', 'MAX(user_id)', '', __METHOD__ );
- $count = 0;
- while ( $end < $max ) {
- $start = $end + 1;
- $end = min( $start + $this->mBatchSize, $max );
- $this->output( "... $start - $end\n" );
- $dbw->insertSelect(
- 'actor',
- 'user',
- [ 'actor_user' => 'user_id', 'actor_name' => 'user_name' ],
- [ "user_id >= $start", "user_id <= $end" ],
+ $tables = $this->getOption( 'tables' );
+ if ( $tables !== null ) {
+ $this->tables = explode( ',', $tables );
+ }
+
+ if ( $this->doTable( 'user' ) ) {
+ $this->output( "Creating actor entries for all registered users\n" );
+ $end = 0;
+ $dbw = $this->getDB( DB_MASTER );
+ $max = $dbw->selectField( 'user', 'MAX(user_id)', '', __METHOD__ );
+ $count = 0;
+ while ( $end < $max ) {
+ $start = $end + 1;
+ $end = min( $start + $this->mBatchSize, $max );
+ $this->output( "... $start - $end\n" );
+ $dbw->insertSelect(
+ 'actor',
+ 'user',
+ [ 'actor_user' => 'user_id', 'actor_name' => 'user_name' ],
+ [ "user_id >= $start", "user_id <= $end" ],
+ __METHOD__,
+ [ 'IGNORE' ],
+ [ 'ORDER BY' => [ 'user_id' ] ]
+ );
+ $count += $dbw->affectedRows();
+ wfWaitForSlaves();
+ }
+ $this->output( "Completed actor creation, added $count new actor(s)\n" );
+ } else {
+ $this->output( "Checking that actors exist for all registered users\n" );
+ $dbr = $this->getDB( DB_REPLICA, [ 'vslow' ] );
+ $anyMissing = $dbr->selectField(
+ [ 'user', 'actor' ],
+ '1',
+ [ 'actor_id' => null ],