From: tisane Date: Thu, 14 Nov 2013 21:11:41 +0000 (-0500) Subject: Add --noredirects parameter to moveBatch.php X-Git-Tag: 1.31.0-rc.0~18134^2 X-Git-Url: http://git.cyclocoop.org//%22javascript:ModifierStyle%28%27%22.%24id.%22%27%29/%22?a=commitdiff_plain;h=8a43bb5e4c16a4ac051c2fad077647a17510d917;p=lhc%2Fweb%2Fwiklou.git Add --noredirects parameter to moveBatch.php Bug: 57077 Change-Id: I8dc1cdc365c5ba09106b9562ce2768fdcf8e5b95 --- diff --git a/maintenance/moveBatch.php b/maintenance/moveBatch.php index 34e6428264..f991c1bdf5 100644 --- a/maintenance/moveBatch.php +++ b/maintenance/moveBatch.php @@ -21,7 +21,7 @@ * @ingroup Maintenance * @author Tim Starling * - * USAGE: php moveBatch.php [-u ] [-r ] [-i ] [listfile] + * USAGE: php moveBatch.php [-u ] [-r ] [-i ] [-noredirects] [listfile] * * [listfile] - file with two titles per line, separated with pipe characters; * the first title is the source, the second is the destination. @@ -29,6 +29,7 @@ * - username to perform moves as * - reason to be given for moves * - number of seconds to sleep after each move + * - suppress creation of redirects * * This will print out error codes from Title::moveTo() if something goes wrong, * e.g. immobile_namespace for namespaces which can't be moved @@ -48,6 +49,7 @@ class MoveBatch extends Maintenance { $this->addOption( 'u', "User to perform move", false, true ); $this->addOption( 'r', "Reason to move page", false, true ); $this->addOption( 'i', "Interval to sleep between moves" ); + $this->addOption( 'noredirects', "Suppress creation of redirects" ); $this->addArg( 'listfile', 'List of pages to move, newline delimited', false ); } @@ -62,6 +64,7 @@ class MoveBatch extends Maintenance { $user = $this->getOption( 'u', 'Move page script' ); $reason = $this->getOption( 'r', '' ); $interval = $this->getOption( 'i', 0 ); + $noredirects = $this->getOption( 'noredirects', false ); if ( $this->hasArg() ) { $file = fopen( $this->getArg(), 'r' ); } else { @@ -99,7 +102,7 @@ class MoveBatch extends Maintenance { $this->output( $source->getPrefixedText() . ' --> ' . $dest->getPrefixedText() ); $dbw->begin( __METHOD__ ); - $err = $source->moveTo( $dest, false, $reason ); + $err = $source->moveTo( $dest, false, $reason, !$noredirects ); if ( $err !== true ) { $msg = array_shift( $err[0] ); $this->output( "\nFAILED: " . wfMessage( $msg, $err[0] )->text() );