From f41a022e821bba5810e7590555a5db987320739d Mon Sep 17 00:00:00 2001 From: Platonides Date: Mon, 12 Apr 2010 17:55:44 +0000 Subject: [PATCH] If an article Special:Foo exists (eg. because of a new alias), cleanupTitles moved it to Foo on namespace -1. Now it is moved to Broken/Special:Foo. Pages in negative namespaces (broken from past cleanupTitles) are moved back to ns 0. See bug 23147#c4. --- RELEASE-NOTES | 2 ++ maintenance/cleanupTitles.php | 16 +++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index b1249f0a17..313512aa39 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -102,6 +102,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Special:Preferences no longer crashes if the wiki default date formatting style is not valid for the user's interface language * (bug 23167) Check the watch checkbox by default if the watchcreations preference is set +* Maintenance script cleanupTitles is now able to fix titles stored +in a negative namespace (which is invalid). === API changes in 1.17 === * (bug 22738) Allow filtering by action type on query=logevent diff --git a/maintenance/cleanupTitles.php b/maintenance/cleanupTitles.php index ed714b2d27..6ef5a28697 100644 --- a/maintenance/cleanupTitles.php +++ b/maintenance/cleanupTitles.php @@ -106,18 +106,23 @@ class TitleCleanup extends TableCleanup { } protected function moveInconsistentPage( $row, $title ) { - if( $title->exists() || $title->getInterwiki() ) { - if( $title->getInterwiki() ) { + if( $title->exists() || $title->getInterwiki() || !$title->canExist() ) { + if( $title->getInterwiki() || !$title->canExist() ) { $prior = $title->getPrefixedDbKey(); } else { $prior = $title->getDBkey(); } + + # Old cleanupTitles could move articles there. See bug 23147. + $ns = $row->page_namespace; + if ( $ns < 0) $ns = 0; + $clean = 'Broken/' . $prior; - $verified = Title::makeTitleSafe( $row->page_namespace, $clean ); + $verified = Title::makeTitleSafe( $ns, $clean ); if( $verified->exists() ) { $blah = "Broken/id:" . $row->page_id; $this->output( "Couldn't legalize; form '$clean' exists; using '$blah'\n" ); - $verified = Title::makeTitleSafe( $row->page_namespace, $blah ); + $verified = Title::makeTitleSafe( $ns, $blah ); } $title = $verified; } @@ -126,8 +131,9 @@ class TitleCleanup extends TableCleanup { } $ns = $title->getNamespace(); $dest = $title->getDBkey(); + if( $this->dryrun ) { - $this->output( "DRY RUN: would rename $row->page_id ($row->page_namespace,'$row->page_title') to ($row->page_namespace,'$dest')\n" ); + $this->output( "DRY RUN: would rename $row->page_id ($row->page_namespace,'$row->page_title') to ($ns,'$dest')\n" ); } else { $this->output( "renaming $row->page_id ($row->page_namespace,'$row->page_title') to ($ns,'$dest')\n" ); $dbw = wfGetDB( DB_MASTER ); -- 2.20.1