Clean up old title on move before reset article id
authorumherirrender <umherirrender_de.wp@web.de>
Fri, 11 Oct 2013 15:26:59 +0000 (17:26 +0200)
committerUmherirrender <umherirrender_de.wp@web.de>
Sun, 20 Oct 2013 17:34:24 +0000 (17:34 +0000)
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

index 56e9b44..0d11821 100644 (file)
@@ -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,