$user = $this->getOption( 'u', false );
$reason = $this->getOption( 'r', '' );
$interval = $this->getOption( 'i', 0 );
- $noredirects = $this->getOption( 'noredirects', false );
+ $noredirects = $this->hasOption( 'noredirects' );
if ( $this->hasArg() ) {
$file = fopen( $this->getArg(), 'r' );
} else {
# Setup
if ( !$file ) {
- $this->error( "Unable to read file, exiting", true );
+ $this->fatalError( "Unable to read file, exiting" );
}
if ( $user === false ) {
$wgUser = User::newSystemUser( 'Move page script', [ 'steal' => true ] );
$wgUser = User::newFromName( $user );
}
if ( !$wgUser ) {
- $this->error( "Invalid username", true );
+ $this->fatalError( "Invalid username" );
}
# Setup complete, now start
$dbw = $this->getDB( DB_MASTER );
- // @codingStandardsIgnoreStart Ignore avoid function calls in a FOR loop test part warning
+ // phpcs:ignore Generic.CodeAnalysis.ForLoopWithTestFunctionCall
for ( $linenum = 1; !feof( $file ); $linenum++ ) {
- // @codingStandardsIgnoreEnd
$line = fgets( $file );
if ( $line === false ) {
break;
$mp = new MovePage( $source, $dest );
$status = $mp->move( $wgUser, $reason, !$noredirects );
if ( !$status->isOK() ) {
- $this->output( "\nFAILED: " . $status->getWikiText() );
+ $this->output( "\nFAILED: " . $status->getWikiText( false, false, 'en' ) );
}
$this->commitTransaction( $dbw, __METHOD__ );
$this->output( "\n" );
if ( $interval ) {
sleep( $interval );
}
- wfWaitForSlaves();
}
}
}
-$maintClass = "MoveBatch";
+$maintClass = MoveBatch::class;
require_once RUN_MAINTENANCE_IF_MAIN;