From d5a429a10ee0ecf1ad1aedadd13a8fbe1fe826ba Mon Sep 17 00:00:00 2001 From: Max Semenik Date: Mon, 10 Jul 2017 15:07:07 -0700 Subject: [PATCH] Fix cleanupTitles.php It was failing in production with duplicate key error in moveInconsistentPage(). Live-patching it to check for existence for updates resolved the issues. Committing the fix now. Change-Id: I1c0bf632b5040b44f5a49c8fb95779e7ed19dea9 --- maintenance/cleanupTitles.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/maintenance/cleanupTitles.php b/maintenance/cleanupTitles.php index ccc6406809..50e17d8dad 100644 --- a/maintenance/cleanupTitles.php +++ b/maintenance/cleanupTitles.php @@ -25,6 +25,8 @@ * @ingroup Maintenance */ +use MediaWiki\MediaWikiServices; + require_once __DIR__ . '/cleanupTable.inc'; /** @@ -130,8 +132,11 @@ class TitleCleanup extends TableCleanup { * @param object $row * @param Title $title */ - protected function moveInconsistentPage( $row, $title ) { - if ( $title->exists() || $title->getInterwiki() || !$title->canExist() ) { + protected function moveInconsistentPage( $row, Title $title ) { + if ( $title->exists( Title::GAID_FOR_UPDATE ) + || $title->getInterwiki() + || !$title->canExist() + ) { if ( $title->getInterwiki() || !$title->canExist() ) { $prior = $title->getPrefixedDBkey(); } else { @@ -179,7 +184,7 @@ class TitleCleanup extends TableCleanup { ], [ 'page_id' => $row->page_id ], __METHOD__ ); - LinkCache::singleton()->clear(); + MediaWikiServices::getInstance()->getLinkCache()->clear(); } } } -- 2.20.1