Index: trunk/phase3/maintenance/cleanupTitles.php |
— | — | @@ -106,18 +106,23 @@ |
107 | 107 | } |
108 | 108 | |
109 | 109 | 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() ) { |
112 | 112 | $prior = $title->getPrefixedDbKey(); |
113 | 113 | } else { |
114 | 114 | $prior = $title->getDBkey(); |
115 | 115 | } |
| 116 | + |
| 117 | + # Old cleanupTitles could move articles there. See bug 23147. |
| 118 | + $ns = $row->page_namespace; |
| 119 | + if ( $ns < 0) $ns = 0; |
| 120 | + |
116 | 121 | $clean = 'Broken/' . $prior; |
117 | | - $verified = Title::makeTitleSafe( $row->page_namespace, $clean ); |
| 122 | + $verified = Title::makeTitleSafe( $ns, $clean ); |
118 | 123 | if( $verified->exists() ) { |
119 | 124 | $blah = "Broken/id:" . $row->page_id; |
120 | 125 | $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 ); |
122 | 127 | } |
123 | 128 | $title = $verified; |
124 | 129 | } |
— | — | @@ -126,8 +131,9 @@ |
127 | 132 | } |
128 | 133 | $ns = $title->getNamespace(); |
129 | 134 | $dest = $title->getDBkey(); |
| 135 | + |
130 | 136 | 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" ); |
132 | 138 | } else { |
133 | 139 | $this->output( "renaming $row->page_id ($row->page_namespace,'$row->page_title') to ($ns,'$dest')\n" ); |
134 | 140 | $dbw = wfGetDB( DB_MASTER ); |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -102,6 +102,8 @@ |
103 | 103 | * Special:Preferences no longer crashes if the wiki default date formatting |
104 | 104 | style is not valid for the user's interface language |
105 | 105 | * (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). |
106 | 108 | |
107 | 109 | === API changes in 1.17 === |
108 | 110 | * (bug 22738) Allow filtering by action type on query=logevent |