From d170edc72f114a161ab3c04bd52f283b1670c058 Mon Sep 17 00:00:00 2001 From: Domas Mituzas Date: Fri, 13 Jan 2006 23:57:02 +0000 Subject: [PATCH] the revert at will style commit: cached sidebar :-) --- includes/MessageCache.php | 3 ++- includes/Skin.php | 12 +++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) 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; } -- 2.20.1