X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FmoveBatch.php;h=b54ed4566b05be0cd41d72272157dc9a1b5565ba;hb=62991fcb7a5027b1eceb5656829c1c65bf9f98cb;hp=090c3d41d080cc2be1c8f279cdc675ab47e19d85;hpb=16ef3e79c4c52aa6b74563b7eadcfc9792e7a4c4;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/moveBatch.php b/maintenance/moveBatch.php index 090c3d41d0..b54ed4566b 100644 --- a/maintenance/moveBatch.php +++ b/maintenance/moveBatch.php @@ -35,6 +35,8 @@ * e.g. immobile_namespace for namespaces which can't be moved */ +use MediaWiki\MediaWikiServices; + require_once __DIR__ . '/Maintenance.php'; /** @@ -65,8 +67,8 @@ class MoveBatch extends Maintenance { $reason = $this->getOption( 'r', '' ); $interval = $this->getOption( 'i', 0 ); $noredirects = $this->hasOption( 'noredirects' ); - if ( $this->hasArg() ) { - $file = fopen( $this->getArg(), 'r' ); + if ( $this->hasArg( 0 ) ) { + $file = fopen( $this->getArg( 0 ), 'r' ); } else { $file = $this->getStdin(); } @@ -86,7 +88,6 @@ class MoveBatch extends Maintenance { # Setup complete, now start $dbw = $this->getDB( DB_MASTER ); - // phpcs:ignore Generic.CodeAnalysis.ForLoopWithTestFunctionCall for ( $linenum = 1; !feof( $file ); $linenum++ ) { $line = fgets( $file ); if ( $line === false ) { @@ -106,10 +107,11 @@ class MoveBatch extends Maintenance { $this->output( $source->getPrefixedText() . ' --> ' . $dest->getPrefixedText() ); $this->beginTransaction( $dbw, __METHOD__ ); - $mp = new MovePage( $source, $dest ); + $mp = MediaWikiServices::getInstance()->getMovePageFactory() + ->newMovePage( $source, $dest ); $status = $mp->move( $wgUser, $reason, !$noredirects ); if ( !$status->isOK() ) { - $this->output( "\nFAILED: " . $status->getWikiText( false, false, 'en' ) ); + $this->output( "\nFAILED: " . $status->getMessage( false, false, 'en' )->text() ); } $this->commitTransaction( $dbw, __METHOD__ ); $this->output( "\n" ); @@ -117,7 +119,6 @@ class MoveBatch extends Maintenance { if ( $interval ) { sleep( $interval ); } - wfWaitForSlaves(); } } }