From: Bartosz DziewoƄski Date: Fri, 26 Jan 2018 03:17:01 +0000 (-0800) Subject: cleanupTitles: Don't add 'Broken/' prefix if the title is valid without it X-Git-Tag: 1.31.0-rc.0~771^2 X-Git-Url: http://git.cyclocoop.org//%22javascript:ModifierStyle%28%27%22.%24id.%22%27%29/%22?a=commitdiff_plain;h=da1cf60167420e6f849152fbf84c06e11ad903a7;p=lhc%2Fweb%2Fwiklou.git cleanupTitles: Don't add 'Broken/' prefix if the title is valid without it In some cases, e.g. changes in Unicode normalization rules or MediaWiki banning some invisible characters that were previously allowed in titles, it's enough to just run the title through normalization and update the database entry. Change-Id: I786f31510bbd58c2ec02fc91918de5241c9050d6 --- diff --git a/maintenance/cleanupTitles.php b/maintenance/cleanupTitles.php index 8c782d9964..5b441f90f1 100644 --- a/maintenance/cleanupTitles.php +++ b/maintenance/cleanupTitles.php @@ -137,7 +137,8 @@ class TitleCleanup extends TableCleanup { || $title->getInterwiki() || !$title->canExist() ) { - if ( $title->getInterwiki() || !$title->canExist() ) { + $titleImpossible = $title->getInterwiki() || !$title->canExist(); + if ( $titleImpossible ) { $prior = $title->getPrefixedDBkey(); } else { $prior = $title->getDBkey(); @@ -155,7 +156,12 @@ class TitleCleanup extends TableCleanup { $ns = 0; } - $clean = 'Broken/' . $prior; + if ( !$titleImpossible && !$title->exists() ) { + // Looks like the current title, after cleaning it up, is valid and available + $clean = $prior; + } else { + $clean = 'Broken/' . $prior; + } $verified = Title::makeTitleSafe( $ns, $clean ); if ( !$verified || $verified->exists() ) { $blah = "Broken/id:" . $row->page_id;