From: Aaron Schulz Date: Sun, 7 Sep 2008 08:24:06 +0000 (+0000) Subject: Fix link cache use with FOR_UPDATE X-Git-Tag: 1.31.0-rc.0~45425 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=761a0e2c6100947a0c67101adef2352370e7fe87;p=lhc%2Fweb%2Fwiklou.git Fix link cache use with FOR_UPDATE --- diff --git a/includes/LinkCache.php b/includes/LinkCache.php index d3cafacf3c..4f74cdd70f 100644 --- a/includes/LinkCache.php +++ b/includes/LinkCache.php @@ -89,8 +89,18 @@ class LinkCache { unset( $this->mBadLinks[$title] ); } - /* obsolete, for old $wgLinkCacheMemcached stuff */ - public function clearLink( $title ) {} + public function clearLink( $title ) { + $dbkey = $title->getPrefixedDbKey(); + if( isset($this->mBadLinks[$dbkey]) ) { + unset($this->mBadLinks[$dbkey]); + } + if( isset($this->mGoodLinks[$dbkey]) ) { + unset($this->mGoodLinks[$dbkey]); + } + if( isset($this->mGoodLinkFields[$dbkey]) ) { + unset($this->mGoodLinkFields[$dbkey]); + } + } public function getGoodLinks() { return $this->mGoodLinks; } public function getBadLinks() { return array_keys( $this->mBadLinks ); } diff --git a/includes/Title.php b/includes/Title.php index 18704c607c..5ef8507c37 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -1921,12 +1921,13 @@ class Title { */ public function getArticleID( $flags = 0 ) { $linkCache = LinkCache::singleton(); - if ( $flags & GAID_FOR_UPDATE ) { + if( $flags & GAID_FOR_UPDATE ) { $oldUpdate = $linkCache->forUpdate( true ); + $linkCache->clearLink( $this ); $this->mArticleID = $linkCache->addLinkObj( $this ); $linkCache->forUpdate( $oldUpdate ); } else { - if ( -1 == $this->mArticleID ) { + if( -1 == $this->mArticleID ) { $this->mArticleID = $linkCache->addLinkObj( $this ); } }