Go to the documentation of this file.
39 static function load( $recache =
false ) {
40 if ( self::$loaded && !$recache ) {
46 # This code is somewhat schema-agnostic, because I'm changing it in a minor release -- TS
47 if ( !isset( self::$row->ss_total_pages ) && self::$row->ss_total_pages == -1 ) {
61 wfDebug( __METHOD__ .
": reading site_stats from slave\n" );
64 if ( !self::isSane(
$row ) ) {
66 wfDebug( __METHOD__ .
": site_stats damaged or missing on slave\n" );
70 if ( !self::isSane(
$row ) ) {
75 wfDebug( __METHOD__ .
": initializing damaged or missing site_stats\n" );
82 if ( !self::isSane(
$row ) ) {
83 wfDebug( __METHOD__ .
": site_stats persistently nonsensical o_O\n" );
93 return $db->selectRow(
'site_stats',
array(
102 ),
false, __METHOD__ );
110 return self::$row->ss_total_views;
118 return self::$row->ss_total_edits;
126 return self::$row->ss_good_articles;
134 return self::$row->ss_total_pages;
142 return self::$row->ss_users;
150 return self::$row->ss_active_users;
158 return self::$row->ss_images;
167 if ( !isset( self::$groupMemberCounts[$group] ) ) {
169 $key =
wfMemcKey(
'SiteStats',
'groupcounts', $group );
173 $hit =
$dbr->selectField(
176 array(
'ug_group' => $group ),
179 $wgMemc->set( $key, $hit, 3600 );
181 self::$groupMemberCounts[$group] = $hit;
183 return self::$groupMemberCounts[$group];
190 if ( !isset( self::$jobs ) ) {
194 if ( self::$jobs == 1 ) {
208 if ( !isset( self::$pageCount[$ns] ) ) {
210 self::$pageCount[$ns] = (int)
$dbr->selectField(
213 array(
'page_namespace' => $ns ),
218 return self::$pageCount[$ns];
232 ||
$row->ss_total_pages <
$row->ss_good_articles
233 ||
$row->ss_total_edits <
$row->ss_total_pages
246 if (
$row->$member > 2000000000 ||
$row->$member < 0 ) {
274 $this->db = $database;
285 $this->mEdits = $this->db->selectField(
'revision',
'COUNT(*)',
'', __METHOD__ );
286 $this->mEdits += $this->db->selectField(
'archive',
'COUNT(*)',
'', __METHOD__ );
295 global $wgArticleCountMethod;
300 'page_is_redirect' => 0,
303 if ( $wgArticleCountMethod ==
'link' ) {
305 $conds[] =
'pl_from=page_id';
306 } elseif ( $wgArticleCountMethod ==
'comma' ) {
312 $conds[] =
'page_len > 0';
315 $this->mArticles = $this->db->selectField(
$tables,
'COUNT(DISTINCT page_id)',
316 $conds, __METHOD__ );
325 $this->mPages = $this->db->selectField(
'page',
'COUNT(*)',
'', __METHOD__ );
334 $this->mUsers = $this->db->selectField(
'user',
'COUNT(*)',
'', __METHOD__ );
343 $this->mViews = $this->db->selectField(
'page',
'SUM(page_counter)',
'', __METHOD__ );
352 $this->mFiles = $this->db->selectField(
'image',
'COUNT(*)',
'', __METHOD__ );
368 $options +=
array(
'update' =>
false,
'views' =>
true,
'activeUsers' =>
false );
374 $counter->articles();
399 'ss_total_edits' => ( $this->mEdits ===
null ? $this->
edits() : $this->mEdits ),
400 'ss_good_articles' => ( $this->mArticles ===
null ? $this->
articles() : $this->mArticles ),
401 'ss_total_pages' => ( $this->mPages ===
null ? $this->
pages() : $this->mPages ),
402 'ss_users' => ( $this->mUsers ===
null ? $this->
users() : $this->mUsers ),
403 'ss_images' => ( $this->mFiles ===
null ? $this->
files() : $this->mFiles ),
405 $this->mViews ?
array(
'ss_total_views' => $this->mViews ) :
array()
409 $dbw->upsert(
'site_stats', $values,
array(
'ss_row_id' ), $values, __METHOD__ );
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
namespace and then decline to actually register it RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist & $tables
static cacheUpdate( $dbw)
globals will be eliminated from MediaWiki replaced by an application object which would be passed to constructors Whether that would be an convenient solution remains to be but certainly PHP makes such object oriented programming models easier than they were in previous versions For the time being MediaWiki programmers will have to work in an environment with some global context At the time of globals were initialised on startup by MediaWiki of these were configuration which are documented in DefaultSettings php There is no comprehensive documentation for the remaining however some of the most important ones are listed below They are typically initialised either in index php or in Setup php For a description of the see design txt $wgTitle Title object created from the request URL $wgOut OutputPage object for HTTP response $wgUser User object for the user associated with the current request $wgLang Language object selected by user preferences $wgContLang Language object associated with the wiki being viewed $wgParser Parser object Parser extensions register their hooks here $wgRequest WebRequest to get request data $wgMemc
static isSane( $row)
Is the provided row of site stats sane, or should it be regenerated?
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
articles()
Count pages in article space(s)
pages()
Count total pages.
wfProfileIn( $functionname)
Begin profiling of a function.
static numberingroup( $group)
Find the number of users in a given user group.
static load( $recache=false)
static getContentNamespaces()
Get a list of all namespace indices which are considered to contain content.
Class designed for counting of stats.
static doAllAndCommit( $database, array $options=array())
Do all updates and commit them.
files()
Count total files.
wfMemcKey()
Get a cache key.
wfProfileOut( $functionname='missing')
Stop profiling of a function.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
when a variable name is used in a it is silently declared as a new masking the global
Class for handling updates to the site_stats table.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
wfDebug( $text, $dest='all')
Sends a line to the debug log if enabled or, optionally, to a comment in output.
Database abstraction object.
Static accessor class for site_stats and related things.
users()
Count total users.
__construct( $database=false)
Constructor.
static singleton( $wiki=false)
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
edits()
Count the total number of edits.
refresh()
Refresh site_stats.
static $groupMemberCounts