From bc8f309bdad5f1f8b95fe14d8fd3bb126594c325 Mon Sep 17 00:00:00 2001 From: umherirrender Date: Fri, 11 Oct 2013 17:26:59 +0200 Subject: [PATCH] Clean up old title on move before reset article id Calling WikiPage::onArticleDelete without a page_id will reload the page id, maybe from a (lagged) slave, than the title has the page id set, and a call to Title::exists return true, which shows the link in blue and the wrong message. Bug: 45348 Change-Id: If415dc1729b0bb1cfe7fc75f9e29638a6797d478 --- includes/Title.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/includes/Title.php b/includes/Title.php index 56e9b44cc5..0d11821d84 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -3903,7 +3903,12 @@ class Title { __METHOD__ ); - $this->resetArticleID( 0 ); + // clean up the old title before reset article id - bug 45348 + if ( !$redirectContent ) { + WikiPage::onArticleDelete( $this ); + } + + $this->resetArticleID( 0 ); // 0 == non existing $nt->resetArticleID( $oldid ); $newpage->loadPageData( WikiPage::READ_LOCKING ); // bug 46397 @@ -3919,13 +3924,12 @@ class Title { } # Recreate the redirect, this time in the other direction. - if ( !$redirectContent ) { - WikiPage::onArticleDelete( $this ); - } else { + if ( $redirectContent ) { $redirectArticle = WikiPage::factory( $this ); $redirectArticle->loadFromRow( false, WikiPage::READ_LOCKING ); // bug 46397 $newid = $redirectArticle->insertOn( $dbw ); if ( $newid ) { // sanity + $this->resetArticleID( $newid ); $redirectRevision = new Revision( array( 'title' => $this, // for determining the default content model 'page' => $newid, -- 2.20.1