Manual:$wgDisableCounters
From MediaWiki.org
| Site Statistics: $wgDisableCounters | |
|---|---|
| Introduced in version: | pre 1.1.0 |
| Removed in version: | still in use |
| Allowed Values: | (boolean) |
| Default Value: | false |
Other settings: Alphabetical | By Function
[edit] Details
$wgDisableCounters determines whether or not to update the number of times a page has been viewed. If $wgDisableCounters is set to false, each page will have a counter in its footer saying: "This page has been accessed X times"
This setting also determines whether Special:Popularpages is available.
This variable is initialized in includes/DefaultSettings.php. The initial value is false. To override the default value, add the line $wgDisableCounters = true; to the file LocalSettings.php
The value of the counter is updated in includes/Article.php in the function incViewCount(). The variable $wgDisableCounters is also referred to in other script files.
[edit] Alternatives
If performance problems due to high hit counts updating the site_stats table is a concern, a less dramatic alternative to disabling them may be to tweak $wgHitcounterUpdateFreq.
[edit] How to skip update of the view counter when a page is accessed by a particular user
Let's say, for example, you decide that you do not want the view counter to be updated when a sysop views a page. Here's how to implement this change:
- in the file
includes/Article.phpsearch forfunction viewUpdates. - find the following two lines of code:
global $wgDisableCounters; if( !$wgDisableCounters && ...
- change them to read:
global $wgDisableCounters, $wgUser; if( !$wgDisableCounters && ... && !$wgUser->isAllowed('block') ) {