From 57e4aef4257250667a824b1db0e5ddc9835ae08f Mon Sep 17 00:00:00 2001 From: Rotem Liss Date: Sat, 9 Feb 2008 11:45:53 +0000 Subject: [PATCH] Fixing message cache updates for MediaWiki messages moves: article ID is now properly set in the Title objects while moving. Removing the direct use of LinkCache in favor of the Title::resetArticleID function. Also updating the cache of the old article. --- RELEASE-NOTES | 1 + includes/Title.php | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 7426f971c0..5444814cf2 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -375,6 +375,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 12952) Using Nosuchusershort instead of Nosuchuser when account creation is disabled * (bug 12869) Magnify icon alignment should be adjusted using linked CSS +* Fixing message cache updates for MediaWiki messages moves == Parser changes in 1.12 == diff --git a/includes/Title.php b/includes/Title.php index b858b2664a..decf6e7ab7 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -2425,6 +2425,8 @@ class Title { # Update message cache for interface messages if( $nt->getNamespace() == NS_MEDIAWIKI ) { global $wgMessageCache; + $oldarticle = new Article( $this ); + $wgMessageCache->replace( $this->getDBkey(), $oldarticle->getContent() ); $newarticle = new Article( $nt ); $wgMessageCache->replace( $nt->getDBkey(), $newarticle->getContent() ); } @@ -2457,7 +2459,6 @@ class Title { $newid = $nt->getArticleID(); $oldid = $this->getArticleID(); $dbw = wfGetDB( DB_MASTER ); - $linkCache =& LinkCache::singleton(); # Delete the old redirect. We don't save it to history since # by definition if we've got here it's rather uninteresting. @@ -2480,7 +2481,7 @@ class Title { /* WHERE */ array( 'page_id' => $oldid ), $fname ); - $linkCache->clearLink( $nt->getPrefixedDBkey() ); + $nt->resetArticleID( $oldid ); # Recreate the redirect, this time in the other direction. if($createRedirect || !$wgUser->isAllowed('suppressredirect')) @@ -2495,7 +2496,6 @@ class Title { 'text' => $redirectText ) ); $redirectRevision->insertOn( $dbw ); $redirectArticle->updateRevisionOn( $dbw, $redirectRevision, 0 ); - $linkCache->clearLink( $this->getPrefixedDBkey() ); # Now, we record the link from the redirect to the new title. # It should have no other outgoing links... @@ -2506,6 +2506,8 @@ class Title { 'pl_namespace' => $nt->getNamespace(), 'pl_title' => $nt->getDBkey() ), $fname ); + } else { + $this->resetArticleID( 0 ); } # Log the move @@ -2539,13 +2541,12 @@ class Title { $oldid = $this->getArticleID(); $dbw = wfGetDB( DB_MASTER ); $now = $dbw->timestamp(); - $linkCache =& LinkCache::singleton(); # Save a null revision in the page's history notifying of the move $nullRevision = Revision::newNullRevision( $dbw, $oldid, $comment, true ); $nullRevId = $nullRevision->insertOn( $dbw ); - # Rename cur entry + # Rename page entry $dbw->update( 'page', /* SET */ array( 'page_touched' => $now, @@ -2556,8 +2557,7 @@ class Title { /* WHERE */ array( 'page_id' => $oldid ), $fname ); - - $linkCache->clearLink( $nt->getPrefixedDBkey() ); + $nt->resetArticleID( $oldid ); if($createRedirect || !$wgUser->isAllowed('suppressredirect')) { @@ -2572,7 +2572,7 @@ class Title { 'text' => $redirectText ) ); $redirectRevision->insertOn( $dbw ); $redirectArticle->updateRevisionOn( $dbw, $redirectRevision, 0 ); - $linkCache->clearLink( $this->getPrefixedDBkey() ); + # Record the just-created redirect's linking to the page $dbw->insert( 'pagelinks', array( @@ -2580,6 +2580,8 @@ class Title { 'pl_namespace' => $nt->getNamespace(), 'pl_title' => $nt->getDBkey() ), $fname ); + } else { + $this->resetArticleID( 0 ); } # Log the move -- 2.20.1