the revert at will style commit: cached sidebar :-)
authorDomas Mituzas <midom@users.mediawiki.org>
Fri, 13 Jan 2006 23:57:02 +0000 (23:57 +0000)
committerDomas Mituzas <midom@users.mediawiki.org>
Fri, 13 Jan 2006 23:57:02 +0000 (23:57 +0000)
includes/MessageCache.php
includes/Skin.php

index de8fd95..c6c56ab 100755 (executable)
@@ -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 );
index 124bc59..eb73b38 100644 (file)
@@ -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;
        }