r64966 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r64965‎ | r64966 | r64967 >
Date:17:55, 12 April 2010
Author:platonides
Status:ok (Comments)
Tags:
Comment:
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.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/maintenance/cleanupTitles.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/cleanupTitles.php
@@ -106,18 +106,23 @@
107107 }
108108
109109 protected function moveInconsistentPage( $row, $title ) {
110 - if( $title->exists() || $title->getInterwiki() ) {
111 - if( $title->getInterwiki() ) {
 110+ if( $title->exists() || $title->getInterwiki() || !$title->canExist() ) {
 111+ if( $title->getInterwiki() || !$title->canExist() ) {
112112 $prior = $title->getPrefixedDbKey();
113113 } else {
114114 $prior = $title->getDBkey();
115115 }
 116+
 117+ # Old cleanupTitles could move articles there. See bug 23147.
 118+ $ns = $row->page_namespace;
 119+ if ( $ns < 0) $ns = 0;
 120+
116121 $clean = 'Broken/' . $prior;
117 - $verified = Title::makeTitleSafe( $row->page_namespace, $clean );
 122+ $verified = Title::makeTitleSafe( $ns, $clean );
118123 if( $verified->exists() ) {
119124 $blah = "Broken/id:" . $row->page_id;
120125 $this->output( "Couldn't legalize; form '$clean' exists; using '$blah'\n" );
121 - $verified = Title::makeTitleSafe( $row->page_namespace, $blah );
 126+ $verified = Title::makeTitleSafe( $ns, $blah );
122127 }
123128 $title = $verified;
124129 }
@@ -126,8 +131,9 @@
127132 }
128133 $ns = $title->getNamespace();
129134 $dest = $title->getDBkey();
 135+
130136 if( $this->dryrun ) {
131 - $this->output( "DRY RUN: would rename $row->page_id ($row->page_namespace,'$row->page_title') to ($row->page_namespace,'$dest')\n" );
 137+ $this->output( "DRY RUN: would rename $row->page_id ($row->page_namespace,'$row->page_title') to ($ns,'$dest')\n" );
132138 } else {
133139 $this->output( "renaming $row->page_id ($row->page_namespace,'$row->page_title') to ($ns,'$dest')\n" );
134140 $dbw = wfGetDB( DB_MASTER );
Index: trunk/phase3/RELEASE-NOTES
@@ -102,6 +102,8 @@
103103 * Special:Preferences no longer crashes if the wiki default date formatting
104104 style is not valid for the user's interface language
105105 * (bug 23167) Check the watch checkbox by default if the watchcreations preference is set
 106+* Maintenance script cleanupTitles is now able to fix titles stored
 107+in a negative namespace (which is invalid).
106108
107109 === API changes in 1.17 ===
108110 * (bug 22738) Allow filtering by action type on query=logevent

Comments

#Comment by Werdna (talk | contribs)   01:41, 9 December 2010

Looks OK to me.

Status & tagging log