MediaWiki REL1_35
SiteStatsInit Class Reference

Class designed for counting of stats. More...

Public Member Functions

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

Static Public Member Functions

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.
 

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, and articles().

Referenced by articles(), and 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 DB_MASTER.

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, and edits().

Referenced by edits(), and refresh().

◆ files()

SiteStatsInit::files ( )

Count total files.

Returns
int

Definition at line 118 of file SiteStatsInit.php.

References $files, and files().

Referenced by files(), and refresh().

◆ getDB()

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

Definition at line 197 of file SiteStatsInit.php.

◆ pages()

SiteStatsInit::pages ( )

Count total pages.

Returns
int

Definition at line 98 of file SiteStatsInit.php.

References $pages, and pages().

Referenced by pages(), and 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, and users().

Referenced by refresh(), and users().

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: