47 $this->dbr = $database;
48 } elseif ( $database ) {
60 $this->
edits = $this->dbr->selectField(
'revision',
'COUNT(*)',
'', __METHOD__ );
61 $this->
edits += $this->dbr->selectField(
'archive',
'COUNT(*)',
'', __METHOD__ );
71 $config = MediaWikiServices::getInstance()->getMainConfig();
75 'page_namespace' => MWNamespace::getContentNamespaces(),
76 'page_is_redirect' => 0,
79 if ( $config->get(
'ArticleCountMethod' ) ==
'link' ) {
81 $conds[] =
'pl_from=page_id';
84 $this->
articles = $this->dbr->selectField(
86 'COUNT(DISTINCT page_id)',
99 $this->
pages = $this->dbr->selectField(
'page',
'COUNT(*)',
'', __METHOD__ );
109 $this->
users = $this->dbr->selectField(
'user',
'COUNT(*)',
'', __METHOD__ );
119 $this->
files = $this->dbr->selectField(
'image',
'COUNT(*)',
'', __METHOD__ );
138 $counter =
new self( $database );
141 $counter->articles();
150 SiteStatsUpdate::cacheUpdate( self::getDB(
DB_MASTER ) );
159 $exists = $dbw->selectField(
'site_stats',
'1', [
'ss_row_id' => 1 ], __METHOD__ );
160 if ( $exists ===
false ) {
197 private static function getDB( $index, $groups = [] ) {
198 $lb = MediaWikiServices::getInstance()->getDBLoadBalancer();
200 return $lb->getConnection( $index, $groups );
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.
static doPlaceholderInit()
Insert a dummy row with all zeroes if no row is present.
files()
Count total files.
static getDB( $index, $groups=[])
refresh()
Refresh site_stats.
users()
Count total users.
__construct( $database=false)
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
this hook is for auditing only 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
processing should stop and the error should be shown to the user * false
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))