Go to the documentation of this file.
43 self::$loaded =
false;
53 static function load( $recache =
false ) {
54 if ( self::$loaded && !$recache ) {
60 # This code is somewhat schema-agnostic, because I'm changing it in a minor release -- TS
61 if ( !isset( self::$row->ss_total_pages ) && self::$row->ss_total_pages == -1 ) {
77 wfDebug( __METHOD__ .
": reading site_stats from replica DB\n" );
80 if ( !self::isSane(
$row ) ) {
82 wfDebug( __METHOD__ .
": site_stats damaged or missing on replica DB\n" );
91 wfDebug( __METHOD__ .
": initializing damaged or missing site_stats\n" );
98 if ( !self::isSane(
$row ) ) {
99 wfDebug( __METHOD__ .
": site_stats persistently nonsensical o_O\n" );
109 return $db->selectRow(
'site_stats', [
138 return self::$row->ss_total_edits;
146 return self::$row->ss_good_articles;
154 return self::$row->ss_total_pages;
162 return self::$row->ss_users;
170 return self::$row->ss_active_users;
178 return self::$row->ss_images;
188 return $cache->getWithSetCallback(
189 wfMemcKey(
'SiteStats',
'groupcounts', $group ),
191 function ( $oldValue, &$ttl,
array &$setOpts )
use ( $group ) {
194 $setOpts += Database::getCacheSetOptions(
$dbr );
196 return $dbr->selectField(
200 'ug_group' => $group,
201 'ug_expiry IS NULL OR ug_expiry >= ' .
$dbr->addQuotes(
$dbr->timestamp() )
206 [
'pcTTL' => $cache::TTL_PROC_LONG ]
214 if ( !isset( self::$jobs ) ) {
224 if ( self::$jobs == 1 ) {
237 if ( !isset( self::$pageCount[$ns] ) ) {
239 self::$pageCount[$ns] = (int)
$dbr->selectField(
242 [
'page_namespace' => $ns ],
246 return self::$pageCount[$ns];
260 ||
$row->ss_total_pages <
$row->ss_good_articles
261 ||
$row->ss_total_edits <
$row->ss_total_pages
273 if (
$row->$member > 2000000000 ||
$row->$member < 0 ) {
301 $this->db = $database;
302 } elseif ( $database ) {
314 $this->mEdits = $this->db->selectField(
'revision',
'COUNT(*)',
'', __METHOD__ );
315 $this->mEdits += $this->db->selectField(
'archive',
'COUNT(*)',
'', __METHOD__ );
324 global $wgArticleCountMethod;
329 'page_is_redirect' => 0,
332 if ( $wgArticleCountMethod ==
'link' ) {
334 $conds[] =
'pl_from=page_id';
335 } elseif ( $wgArticleCountMethod ==
'comma' ) {
341 $conds[] =
'page_len > 0';
344 $this->mArticles = $this->db->selectField(
$tables,
'COUNT(DISTINCT page_id)',
345 $conds, __METHOD__ );
354 $this->mPages = $this->db->selectField(
'page',
'COUNT(*)',
'', __METHOD__ );
363 $this->mUsers = $this->db->selectField(
'user',
'COUNT(*)',
'', __METHOD__ );
372 $this->mFiles = $this->db->selectField(
'image',
'COUNT(*)',
'', __METHOD__ );
393 $counter->articles();
420 $dbw->upsert(
'site_stats', $values, [
'ss_row_id' ], $values, __METHOD__ );
processing should stop and the error should be shown to the user * false
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist & $tables
static doAllAndCommit( $database, array $options=[])
Do all updates and commit them.
static cacheUpdate( $dbw)
static isSane( $row)
Is the provided row of site stats sane, or should it be regenerated?
articles()
Count pages in article space(s)
pages()
Count total pages.
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
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.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
files()
Count total files.
wfMemcKey()
Make a cache key for the local wiki.
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
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.
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException' returning false will NOT prevent logging $e
Static accessor class for site_stats and related things.
users()
Count total users.
$wgMiserMode
Disable database-intensive features.
static getMainWANInstance()
Get the main WAN cache object.
__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.
static views()
Return the total number of page views.
static bool stdClass $row
refresh()
Refresh site_stats.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist and Watchlist you will want to construct new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects When constructing you specify which group they belong to You can reuse existing or create your you must register them with $special registerFilterGroup removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context $options
the array() calling protocol came about after MediaWiki 1.4rc1.