From eea37c081961ba477d694ea25d3b6fb923146568 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 28 Jun 2006 20:31:04 +0000 Subject: [PATCH] * Allow page moves over historyless self-redirects. Such are usually created as part of namespace rearrangements, and it's easier to clean them up if we can move over them. * Show some error results in moveBatch.php --- RELEASE-NOTES | 4 ++++ includes/Title.php | 7 ++++++- maintenance/moveBatch.php | 5 ++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 3b79016598..9a2e7aa1e3 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -591,6 +591,10 @@ Some default configuration options have changed: * Added Latvian localization (lv) * (bug 6472) Fix regression in Special:Export with multiple pages * Update to Macedonian translation (mk) +* Allow page moves over historyless self-redirects. Such are usually created + as part of namespace rearrangements, and it's easier to clean them up if + we can move over them. +* Show some error results in moveBatch.php == Compatibility == diff --git a/includes/Title.php b/includes/Title.php index 6c29bc6695..da0e589034 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -2009,19 +2009,24 @@ class Title { if ( !$obj || 0 == $obj->page_is_redirect ) { # Not a redirect + wfDebug( __METHOD__ . ": not a redirect\n" ); return false; } $text = Revision::getRevisionText( $obj ); # Does the redirect point to the source? + # Or is it a broken self-redirect, usually caused by namespace collisions? if ( preg_match( "/\\[\\[\\s*([^\\]\\|]*)]]/", $text, $m ) ) { $redirTitle = Title::newFromText( $m[1] ); if( !is_object( $redirTitle ) || - $redirTitle->getPrefixedDBkey() != $this->getPrefixedDBkey() ) { + ( $redirTitle->getPrefixedDBkey() != $this->getPrefixedDBkey() && + $redirTitle->getPrefixedDBkey() != $nt->getPrefixedDBkey() ) ) { + wfDebug( __METHOD__ . ": redirect points to other page\n" ); return false; } } else { # Fail safe + wfDebug( __METHOD__ . ": failsafe\n" ); return false; } diff --git a/maintenance/moveBatch.php b/maintenance/moveBatch.php index ae47008482..8d7141cd4e 100644 --- a/maintenance/moveBatch.php +++ b/maintenance/moveBatch.php @@ -68,7 +68,10 @@ for ( $linenum = 1; !feof( $file ); $linenum++ ) { print $source->getPrefixedText(); $dbw->begin(); - $source->moveTo( $dest, false, $reason ); + $err = $source->moveTo( $dest, false, $reason ); + if( $err !== true ) { + print "\nFAILED: $err"; + } $dbw->immediateCommit(); print "\n"; -- 2.20.1