MediaWiki  1.34.0
SiteStatsInit Class Reference

Class designed for counting of stats. More...

Public Member Functions

 __construct ( $database=false)
 
 articles ()
 Count pages in article space(s) More...
 
 edits ()
 Count the total number of edits. More...
 
 files ()
 Count total files. More...
 
 pages ()
 Count total pages. More...
 
 refresh ()
 Refresh site_stats. More...
 
 users ()
 Count total users. More...
 

Static Public Member Functions

static doAllAndCommit ( $database, array $options=[])
 Do all updates and commit them. More...
 
static doPlaceholderInit ()
 Insert a dummy row with all zeroes if no row is present. More...
 

Static Private Member Functions

static getDB ( $index, $groups=[])
 

Private Attributes

int $articles
 
 $dbr
 
int $edits
 
int $files
 
int $pages
 
int $users
 

Detailed Description

Class designed for counting of stats.

Definition at line 26 of file SiteStatsInit.php.

Constructor & Destructor Documentation

◆ __construct()

SiteStatsInit::__construct (   $database = false)
Parameters
bool | IDatabase$database
  • bool: Whether to use the master DB
  • IDatabase: Database connection to use

Definition at line 45 of file SiteStatsInit.php.

References DB_MASTER, DB_REPLICA, and getDB().

Member Function Documentation

◆ articles()

SiteStatsInit::articles ( )

Count pages in article space(s)

Returns
int

Definition at line 70 of file SiteStatsInit.php.

References $articles.

Referenced by refresh().

◆ doAllAndCommit()

static SiteStatsInit::doAllAndCommit (   $database,
array  $options = [] 
)
static

Do all updates and commit them.

More or less a replacement for the original initStats, but without output.

Parameters
IDatabase | bool$database
  • bool: Whether to use the master DB
  • IDatabase: Database connection to use
array$optionsArray of options, may contain the following values
  • activeUsers bool: Whether to update the number of active users (default: false)

Definition at line 134 of file SiteStatsInit.php.

References SiteStatsUpdate\cacheUpdate(), DB_MASTER, and getDB().

Referenced by DatabaseUpdater\checkStats(), and SiteStats\loadAndLazyInit().

◆ doPlaceholderInit()

static SiteStatsInit::doPlaceholderInit ( )
static

Insert a dummy row with all zeroes if no row is present.

Definition at line 157 of file SiteStatsInit.php.

References DB_MASTER, getDB(), and SiteStats\selectFields().

Referenced by SiteStats\loadAndLazyInit().

◆ edits()

SiteStatsInit::edits ( )

Count the total number of edits.

Returns
int

Definition at line 59 of file SiteStatsInit.php.

References $edits.

Referenced by refresh().

◆ files()

SiteStatsInit::files ( )

Count total files.

Returns
int

Definition at line 118 of file SiteStatsInit.php.

References $files.

Referenced by refresh().

◆ getDB()

static SiteStatsInit::getDB (   $index,
  $groups = [] 
)
staticprivate
Parameters
int$index
string[] | string$groups
Returns
IDatabase

Definition at line 197 of file SiteStatsInit.php.

Referenced by __construct(), doPlaceholderInit(), and refresh().

◆ pages()

SiteStatsInit::pages ( )

Count total pages.

Returns
int

Definition at line 98 of file SiteStatsInit.php.

References $pages.

Referenced by refresh().

◆ refresh()

SiteStatsInit::refresh ( )

Refresh site_stats.

Definition at line 173 of file SiteStatsInit.php.

References $articles, $edits, $files, $pages, $users, articles(), DB_MASTER, edits(), files(), getDB(), pages(), and users().

◆ users()

SiteStatsInit::users ( )

Count total users.

Returns
int

Definition at line 108 of file SiteStatsInit.php.

References $users.

Referenced by refresh().

Member Data Documentation

◆ $articles

int SiteStatsInit::$articles
private

Definition at line 32 of file SiteStatsInit.php.

Referenced by articles(), and refresh().

◆ $dbr

SiteStatsInit::$dbr
private

Definition at line 28 of file SiteStatsInit.php.

◆ $edits

int SiteStatsInit::$edits
private

Definition at line 30 of file SiteStatsInit.php.

Referenced by edits(), and refresh().

◆ $files

int SiteStatsInit::$files
private

Definition at line 38 of file SiteStatsInit.php.

Referenced by files(), and refresh().

◆ $pages

int SiteStatsInit::$pages
private

Definition at line 34 of file SiteStatsInit.php.

Referenced by pages(), and refresh().

◆ $users

int SiteStatsInit::$users
private

Definition at line 36 of file SiteStatsInit.php.

Referenced by refresh(), and users().


The documentation for this class was generated from the following file: