Watchlist caching, and some junk in DefaultSettings.php which will hopefully be used...
authorTim Starling <tstarling@users.mediawiki.org>
Sun, 25 Jan 2004 02:33:34 +0000 (02:33 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Sun, 25 Jan 2004 02:33:34 +0000 (02:33 +0000)
includes/DefaultSettings.php
includes/SpecialWatchlist.php

index 0893d83..e24997f 100644 (file)
@@ -39,6 +39,11 @@ $wgDBminWordLen     = 4;
 $wgDBtransactions      = false; # Set to true if using InnoDB tables
 $wgDBmysql4                    = false; # Set to true to use enhanced fulltext search
 
+# Database load balancer
+$wgDBservers           = false; # e.g. array("larousse", "pliny")
+$wgDBloads                     = false; # e.g. array(0.6, 0.4);
+
+
 # memcached settings
 # See docs/memcached.doc
 #
@@ -141,6 +146,9 @@ $wgDisableCookieCheck = false;
 
 $wgAllowExternalImages = true;
 $wgMiserMode = false; # Disable database-intensive features
+$wgDisableQueryPages = false; # Disable all query pages if miser mode is on, not just some
+$wgUseWatchlistCache = false; # Generate a watchlist once every hour or so
+$wgWLCacheTimeout = 3600;      # The hour or so mentioned above
 
 # To use inline TeX, you need to compile 'texvc' (in the 'math' subdirectory
 # of the MediaWiki package and have latex, dvips, gs (ghostscript), and
index 136cb3f..08d8ae4 100644 (file)
@@ -4,7 +4,8 @@ include_once( "WatchedItem.php" );
 
 function wfSpecialWatchlist()
 {
-       global $wgUser, $wgOut, $wgLang, $wgTitle;
+       global $wgUser, $wgOut, $wgLang, $wgTitle, $wgMemc;
+       global $wgUseWatchlistCache, $wgWLCacheTimeout, $wgDBname;
        global $days, $limit, $target; # From query string
        $fname = "wfSpecialWatchlist";
 
@@ -38,6 +39,17 @@ function wfSpecialWatchlist()
                $wgOut->addHTML( "done.\n<p>" );
        }
 
+       if ( $wgUseWatchlistCache ) {
+               $memckey = "$wgDBname:watchlist:id:" . $wgUser->getId();
+               $cache_s = @$wgMemc->get( $memckey );
+               if( $cache_s ){
+                       $wgOut->addHTML( wfMsg("wlsaved") );
+                       $wgOut->addHTML( $cache_s );
+                       return;
+               }
+       }
+
+
        $sql = "SELECT COUNT(*) AS n FROM watchlist WHERE wl_user=$uid";
        $res = wfQuery( $sql, DB_READ );
        $s = wfFetchObject( $res );
@@ -162,6 +174,10 @@ function wfSpecialWatchlist()
 
        wfFreeResult( $res );
        $wgOut->addHTML( $s );
+
+       if ( $wgUseWatchlistCache ) {
+               $wgMemc->set( $memckey, $s, $wgWLCacheTimeout);
+       }
 }