One more password bug fix, DisableCounters flag.
authorLee Daniel Crocker <lcrocker@users.mediawiki.org>
Thu, 1 May 2003 00:19:49 +0000 (00:19 +0000)
committerLee Daniel Crocker <lcrocker@users.mediawiki.org>
Thu, 1 May 2003 00:19:49 +0000 (00:19 +0000)
LocalSettings.sample
includes/DefaultSettings.php
includes/SiteStatsUpdate.php
includes/Skin.php
includes/SpecialPreferences.php
includes/ViewCountUpdate.php

index e48f50d..d1696d5 100644 (file)
@@ -51,4 +51,11 @@ $wgLocalInterwiki   = "w";
 $wgInputEncoding       = "ISO-8859-1";
 $wgOutputEncoding      = "ISO-8859-1";
 
+# Extremely high-traffic wikis may want to disable
+# some database-intensive features here:
+#
+# $wgDisableTextSearch = true;
+# $wgDisableCounters = true;
+# $wgMiserMode         = true;
+
 ?>
index 6b9746c..1ab6d19 100644 (file)
@@ -1,6 +1,10 @@
 <?
 # DO NOT EDIT THIS FILE!
 # To customize your installation, edit "LocalSettings.php".
+# Note that since all these string interpolations are expanded
+# before LocalSettings is included, if you localize something
+# like $wgScriptPath, you must also localize everything that
+# depends on it.
 
 $wgServer           = "http://" . getenv( "SERVER_NAME" );
 $wgScriptPath      = "/wiki";
index 61ca846..3661dca 100644 (file)
@@ -14,6 +14,9 @@ class SiteStatsUpdate {
 
        function doUpdate()
        {
+               global $wgDisableCounters;
+               if ( $wgDisableCounters ) { return; }
+
                $a = array();
 
                if ( $this->mViews < 0 ) { $m = "-1"; }
index 303ad17..5f219bd 100644 (file)
@@ -533,11 +533,14 @@ function toggleVisibility( _levelId, _otherId, _linkId) {
                if ( isset( $oldid ) || isset( $diff ) ) { return ""; }
                if ( 0 == $wgArticle->getID() ) { return ""; }
 
-               $count = $wgArticle->getCount();
-               $s = str_replace( "$1", $count, wfMsg( "viewcount" ) );
-
+               if ( $wgDisableCounts ) {
+                       $s = "";
+               } else {
+                       $count = $wgArticle->getCount();
+                       $s = str_replace( "$1", $count, wfMsg( "viewcount" ) );
+               }
                $s .= $this->lastModified();
-               $s .= " ".wfMsg( "gnunote" ) ;
+               $s .= " " . wfMsg( "gnunote" );
                return "<span id='pagestats'>{$s}</span>";
        }
 
index fb0dfac..082ea94 100644 (file)
@@ -40,7 +40,7 @@ function wfSpecialPreferences()
                        mainPrefsForm( wfMsg( "badretype" ) );                  
                        return;
                }
-               $ep = User::encryptPassword( $wpOldpass );
+               $ep = $wgUser->encryptPassword( $wpOldpass );
                if ( $ep != $wgUser->getPassword() ) {
                        if ( $ep != $wgUser->getNewpassword() ) {
                                mainPrefsForm( wfMsg( "wrongpassword" ) );
index 676ce80..954c591 100644 (file)
@@ -12,6 +12,9 @@ class ViewCountUpdate {
 
        function doUpdate()
        {
+               global $wgDisableCounters;
+               if ( $wgDisableCounters ) { return; }
+
                $sql = "UPDATE LOW_PRIORITY cur SET cur_counter=(1+cur_counter)," .
                  "cur_timestamp=cur_timestamp WHERE cur_id={$this->mPageID}";
                $res = wfQuery( $sql, "ViewCountUpdate::doUpdate" );