From: Domas Mituzas Date: Fri, 13 Jan 2006 23:57:02 +0000 (+0000) Subject: the revert at will style commit: cached sidebar :-) X-Git-Tag: 1.6.0~567 X-Git-Url: http://git.cyclocoop.org/%22.%24h.%22?a=commitdiff_plain;h=d170edc72f114a161ab3c04bd52f283b1670c058;p=lhc%2Fweb%2Fwiklou.git the revert at will style commit: cached sidebar :-) --- diff --git a/includes/MessageCache.php b/includes/MessageCache.php index de8fd95069..c6c56abd57 100755 --- a/includes/MessageCache.php +++ b/includes/MessageCache.php @@ -289,10 +289,11 @@ class MessageCache { } function replace( $title, $text ) { - global $wgLocalMessageCache; + global $wgLocalMessageCache, $parserMemc, $wgDBname; $this->lock(); $this->load(); + $parserMemc->delete("$wgDBname:sidebar"); if ( is_array( $this->mCache ) ) { $this->mCache[$title] = $text; $this->mMemc->set( $this->mMemcKey, $this->mCache, $this->mExpiry ); diff --git a/includes/Skin.php b/includes/Skin.php index 124bc5958a..eb73b38d3b 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -1393,11 +1393,16 @@ END; * @access private */ function buildSidebar() { - global $wgTitle, $action; + global $wgTitle, $action, $wgDBname, $parserMemc; $fname = 'SkinTemplate::buildSidebar'; - $pageurl = $wgTitle->getLocalURL(); + wfProfileIn( $fname ); + $cachedsidebar=$parserMemc->get("{$wgDBname}:sidebar"); + if ($cachedsidebar!="") { + wfProfileOut($fname); + return $cachedsidebar; + } $bar = array(); $lines = explode( "\n", wfMsgForContent( 'sidebar' ) ); @@ -1422,12 +1427,13 @@ END; 'text' => $text, 'href' => $href, 'id' => 'n-' . strtr($line[1], ' ', '-'), - 'active' => $pageurl == $href + 'active' => false ); } else { continue; } } } + $cachednotice=$parserMemc->set("{$wgDBname}:sidebar",$bar,86400); wfProfileOut( $fname ); return $bar; }