40 self::$loaded =
false;
50 static function load( $recache =
false ) {
51 if ( self::$loaded && !$recache ) {
57 # This code is somewhat schema-agnostic, because I'm changing it in a minor release -- TS
58 if ( !isset( self::$row->ss_total_pages ) && self::$row->ss_total_pages == -1 ) {
74 wfDebug( __METHOD__ .
": reading site_stats from replica DB\n" );
77 if ( !self::isSane(
$row ) ) {
79 wfDebug( __METHOD__ .
": site_stats damaged or missing on replica DB\n" );
88 wfDebug( __METHOD__ .
": initializing damaged or missing site_stats\n" );
95 if ( !self::isSane(
$row ) ) {
96 wfDebug( __METHOD__ .
": site_stats persistently nonsensical o_O\n" );
106 return $db->selectRow(
'site_stats', [
135 return self::$row->ss_total_edits;
143 return self::$row->ss_good_articles;
151 return self::$row->ss_total_pages;
159 return self::$row->ss_users;
167 return self::$row->ss_active_users;
175 return self::$row->ss_images;
184 $cache = ObjectCache::getMainWANInstance();
185 return $cache->getWithSetCallback(
186 wfMemcKey(
'SiteStats',
'groupcounts', $group ),
188 function ( $oldValue, &$ttl,
array &$setOpts )
use ( $group ) {
191 $setOpts += Database::getCacheSetOptions(
$dbr );
193 return $dbr->selectField(
196 [
'ug_group' => $group ],
200 [
'pcTTL' => $cache::TTL_PROC_LONG ]
208 if ( !isset( self::$jobs ) ) {
218 if ( self::$jobs == 1 ) {
231 if ( !isset( self::$pageCount[$ns] ) ) {
233 self::$pageCount[$ns] = (int)
$dbr->selectField(
236 [
'page_namespace' => $ns ],
240 return self::$pageCount[$ns];
254 ||
$row->ss_total_pages <
$row->ss_good_articles
255 ||
$row->ss_total_edits <
$row->ss_total_pages
267 if (
$row->$member > 2000000000 ||
$row->$member < 0 ) {
295 $this->db = $database;
296 } elseif ( $database ) {
308 $this->mEdits = $this->db->selectField(
'revision',
'COUNT(*)',
'', __METHOD__ );
309 $this->mEdits += $this->db->selectField(
'archive',
'COUNT(*)',
'', __METHOD__ );
322 'page_namespace' => MWNamespace::getContentNamespaces(),
323 'page_is_redirect' => 0,
328 $conds[] =
'pl_from=page_id';
335 $conds[] =
'page_len > 0';
338 $this->mArticles = $this->db->selectField(
$tables,
'COUNT(DISTINCT page_id)',
339 $conds, __METHOD__ );
348 $this->mPages = $this->db->selectField(
'page',
'COUNT(*)',
'', __METHOD__ );
357 $this->mUsers = $this->db->selectField(
'user',
'COUNT(*)',
'', __METHOD__ );
366 $this->mFiles = $this->db->selectField(
'image',
'COUNT(*)',
'', __METHOD__ );
387 $counter->articles();
414 $dbw->upsert(
'site_stats', $values, [
'ss_row_id' ], $values, __METHOD__ );
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
$wgArticleCountMethod
Method used to determine if a page in a content namespace should be counted as a valid article.
$wgMiserMode
Disable database-intensive features.
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
wfMemcKey()
Make a cache key for the local wiki.
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
static singleton( $wiki=false)
Class designed for counting of stats.
edits()
Count the total number of edits.
pages()
Count total pages.
articles()
Count pages in article space(s)
static doAllAndCommit( $database, array $options=[])
Do all updates and commit them.
files()
Count total files.
refresh()
Refresh site_stats.
users()
Count total users.
__construct( $database=false)
Constructor.
Class for handling updates to the site_stats table.
static cacheUpdate( $dbw)
Static accessor class for site_stats and related things.
static isSane( $row)
Is the provided row of site stats sane, or should it be regenerated?
static views()
Return the total number of page views.
static load( $recache=false)
static bool stdClass $row
static numberingroup( $group)
Find the number of users in a given user group.
when a variable name is used in a it is silently declared as a new local masking the global
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
the array() calling protocol came about after MediaWiki 1.4rc1.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist & $tables
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist 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
processing should stop and the error should be shown to the user * false
returning false will NOT prevent logging $e
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
Basic database interface for live and lazy-loaded relation database handles.
MediaWiki has optional support for a high distributed memory object caching system For general information on but for a larger site with heavy load