MediaWiki  1.23.2
SiteStatsUpdate Class Reference

Class for handling updates to the site_stats table. More...

Inheritance diagram for SiteStatsUpdate:
Collaboration diagram for SiteStatsUpdate:

Public Member Functions

 __construct ( $views, $edits, $good, $pages=0, $users=0)
 
 doUpdate ()
 Perform the actual work. More...
 
 tryDBUpdateInternal ()
 Do not call this outside of SiteStatsUpdate. More...
 

Static Public Member Functions

static cacheUpdate ( $dbw)
 
static factory (array $deltas)
 

Protected Member Functions

 adjustPending ( $type, $delta)
 Adjust the pending deltas for a stat type. More...
 
 appendUpdate (&$sql, $field, $delta)
 
 doUpdatePendingDeltas ()
 
 getPendingDeltas ()
 Get pending delta counters for each stat type. More...
 
 removePendingDeltas (array $pd)
 Reduce pending delta counters after updates have been applied. More...
 

Protected Attributes

int $articles = 0
 
int $edits = 0
 
int $images = 0
 
int $pages = 0
 
int $users = 0
 
int $views = 0
 

Private Member Functions

 getTypeCacheKey ( $type, $sign)
 

Detailed Description

Class for handling updates to the site_stats table.

Definition at line 24 of file SiteStatsUpdate.php.

Constructor & Destructor Documentation

◆ __construct()

SiteStatsUpdate::__construct (   $views,
  $edits,
  $good,
  $pages = 0,
  $users = 0 
)

Definition at line 38 of file SiteStatsUpdate.php.

References $edits, $pages, $users, $views, edits, and pages.

Member Function Documentation

◆ adjustPending()

SiteStatsUpdate::adjustPending (   $type,
  $delta 
)
protected

Adjust the pending deltas for a stat type.

Each stat type has two pending counters, one for increments and decrements

Parameters
string$type
int$deltaDelta (positive or negative)

Definition at line 198 of file SiteStatsUpdate.php.

References $type, $wgMemc, getTypeCacheKey(), and global.

Referenced by doUpdatePendingDeltas().

◆ appendUpdate()

SiteStatsUpdate::appendUpdate ( $sql,
  $field,
  $delta 
)
protected
Parameters
string$sql
string$field
int$delta

Definition at line 170 of file SiteStatsUpdate.php.

Referenced by tryDBUpdateInternal().

◆ cacheUpdate()

static SiteStatsUpdate::cacheUpdate (   $dbw)
static
Parameters
DatabaseBase$dbw
Returns
bool|mixed

Definition at line 129 of file SiteStatsUpdate.php.

References $dbr, array(), DB_SLAVE, global, TS_UNIX, wfGetDB(), and wfTimestamp().

Referenced by SiteStatsInit\doAllAndCommit(), SpecialStatistics\execute(), and InitSiteStats\execute().

◆ doUpdate()

SiteStatsUpdate::doUpdate ( )

Perform the actual work.

Implements DeferrableUpdate.

Definition at line 63 of file SiteStatsUpdate.php.

References array(), DB_MASTER, doUpdatePendingDeltas(), global, and wfGetDB().

◆ doUpdatePendingDeltas()

SiteStatsUpdate::doUpdatePendingDeltas ( )
protected

Definition at line 156 of file SiteStatsUpdate.php.

References adjustPending(), edits, and pages.

Referenced by doUpdate(), and tryDBUpdateInternal().

◆ factory()

static SiteStatsUpdate::factory ( array  $deltas)
static
Parameters
array$deltas
Returns
SiteStatsUpdate

Definition at line 50 of file SiteStatsUpdate.php.

References array(), and as.

Referenced by LocalFile\delete(), LocalFileRestoreBatch\execute(), and LocalFile\recordUpload2().

◆ getPendingDeltas()

SiteStatsUpdate::getPendingDeltas ( )
protected

Get pending delta counters for each stat type.

Returns
array Positive and negative deltas for each type

Definition at line 219 of file SiteStatsUpdate.php.

References $type, $wgMemc, array(), as, and global.

Referenced by tryDBUpdateInternal().

◆ getTypeCacheKey()

SiteStatsUpdate::getTypeCacheKey (   $type,
  $sign 
)
private
Parameters
string$type
string$sign('+' or '-')
Returns
string

Definition at line 188 of file SiteStatsUpdate.php.

References $type, and wfMemcKey().

Referenced by adjustPending(), and removePendingDeltas().

◆ removePendingDeltas()

SiteStatsUpdate::removePendingDeltas ( array  $pd)
protected

Reduce pending delta counters after updates have been applied.

Parameters
array$pdResult of getPendingDeltas(), used for DB update

Definition at line 238 of file SiteStatsUpdate.php.

References $type, $wgMemc, as, getTypeCacheKey(), and global.

Referenced by tryDBUpdateInternal().

◆ tryDBUpdateInternal()

SiteStatsUpdate::tryDBUpdateInternal ( )

Member Data Documentation

◆ $articles

int SiteStatsUpdate::$articles = 0
protected

Definition at line 31 of file SiteStatsUpdate.php.

◆ $edits

int SiteStatsUpdate::$edits = 0
protected

Definition at line 27 of file SiteStatsUpdate.php.

Referenced by __construct().

◆ $images

int SiteStatsUpdate::$images = 0
protected

Definition at line 35 of file SiteStatsUpdate.php.

◆ $pages

int SiteStatsUpdate::$pages = 0
protected

Definition at line 29 of file SiteStatsUpdate.php.

Referenced by __construct().

◆ $users

int SiteStatsUpdate::$users = 0
protected

Definition at line 33 of file SiteStatsUpdate.php.

Referenced by __construct().

◆ $views

int SiteStatsUpdate::$views = 0
protected

Definition at line 25 of file SiteStatsUpdate.php.

Referenced by __construct().


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