If an article Special:Foo exists (eg. because of a new alias), cleanupTitles moved...
authorPlatonides <platonides@users.mediawiki.org>
Mon, 12 Apr 2010 17:55:44 +0000 (17:55 +0000)
committerPlatonides <platonides@users.mediawiki.org>
Mon, 12 Apr 2010 17:55:44 +0000 (17:55 +0000)
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
maintenance/cleanupTitles.php

index b1249f0..313512a 100644 (file)
@@ -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
index ed714b2..6ef5a28 100644 (file)
@@ -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 );