From da1cf60167420e6f849152fbf84c06e11ad903a7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bartosz=20Dziewo=C5=84ski?= Date: Thu, 25 Jan 2018 19:17:01 -0800 Subject: [PATCH] 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 --- maintenance/cleanupTitles.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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; -- 2.20.1