MediaWiki  1.23.14
SiteSQLStore Class Reference
Inheritance diagram for SiteSQLStore:
Collaboration diagram for SiteSQLStore:

Public Member Functions

 clear ()
 Clears the list of sites stored in the database. More...
 
 getSite ( $globalId, $source='cache')
 
 getSites ( $source='cache')
 
 reset ()
 Purges the internal and external cache of the site list, forcing the list of sites to be re-read from the database. More...
 
 saveSite (Site $site)
 
 saveSites (array $sites)
 

Static Public Member Functions

static newInstance (ORMTable $sitesTable=null)
 

Protected Member Functions

 __construct (ORMTable $sitesTable=null)
 Constructor. More...
 
 getCacheKey ()
 Constructs a cache key to use for caching the list of sites. More...
 
 getRowFromSite (Site $site)
 Get a new ORMRow from a Site object. More...
 
 loadSites ()
 Fetches the site from the database and loads them into the sites field. More...
 
 newSitesTable ()
 
 siteFromRow (ORMRow $siteRow)
 Returns a new Site object constructed from the provided ORMRow. More...
 

Protected Attributes

SiteList null $sites = null
 
ORMTable $sitesTable
 

Private Attributes

string null $cacheKey = null
 
int $cacheTimeout = 3600
 

Detailed Description

Definition at line 31 of file SiteSQLStore.php.

Constructor & Destructor Documentation

◆ __construct()

SiteSQLStore::__construct ( ORMTable  $sitesTable = null)
protected

Constructor.

Since
1.21
Parameters
ORMTable | null$sitesTable

Definition at line 69 of file SiteSQLStore.php.

References $sitesTable, and newSitesTable().

Member Function Documentation

◆ clear()

SiteSQLStore::clear ( )

Clears the list of sites stored in the database.

See also
SiteStore::clear()
Returns
bool success

Implements SiteStore.

Definition at line 391 of file SiteSQLStore.php.

References $ok, reset(), wfProfileIn(), and wfProfileOut().

◆ getCacheKey()

SiteSQLStore::getCacheKey ( )
protected

Constructs a cache key to use for caching the list of sites.

This includes the concrete class name of the site list as well as a version identifier for the list's serialization, to avoid problems when unserializing site lists serialized by an older version, e.g. when reading from a cache.

The cache key also includes information about where the sites were loaded from, e.g. the name of a database table.

See also
SiteList::getSerialVersionId
Returns
String The cache key.

Definition at line 91 of file SiteSQLStore.php.

References $cacheKey, $source, $type, false, SiteList\getSerialVersionId(), wfMemcKey(), wfProfileIn(), and wfProfileOut().

Referenced by getSites(), loadSites(), and reset().

◆ getRowFromSite()

SiteSQLStore::getRowFromSite ( Site  $site)
protected

◆ getSite()

SiteSQLStore::getSite (   $globalId,
  $source = 'cache' 
)
See also
SiteStore::getSite
Since
1.21
Parameters
string$globalId
string$source
Returns
Site|null

Implements SiteStore.

Definition at line 270 of file SiteSQLStore.php.

References $sites, $source, SiteList\getSite(), getSites(), SiteList\hasSite(), wfProfileIn(), and wfProfileOut().

◆ getSites()

SiteSQLStore::getSites (   $source = 'cache')
See also
SiteStore::getSites
Since
1.21
Parameters
string$sourceeither 'cache' or 'recache'
Returns
SiteList

Implements SiteStore.

Definition at line 118 of file SiteSQLStore.php.

References $cache, $sites, $source, getCacheKey(), loadSites(), wfGetMainCache(), wfProfileIn(), and wfProfileOut().

Referenced by getSite(), and Sites\getSiteGroup().

◆ loadSites()

SiteSQLStore::loadSites ( )
protected

Fetches the site from the database and loads them into the sites field.

Since
1.21

Definition at line 225 of file SiteSQLStore.php.

References $cache, array(), as, getCacheKey(), select(), siteFromRow(), wfGetDB(), wfGetMainCache(), wfProfileIn(), and wfProfileOut().

Referenced by getSites().

◆ newInstance()

static SiteSQLStore::newInstance ( ORMTable  $sitesTable = null)
static

◆ newSitesTable()

SiteSQLStore::newSitesTable ( )
protected
Since
1.21
Returns
ORMTable

Definition at line 419 of file SiteSQLStore.php.

References array(), Site\GROUP_NONE, Site\SOURCE_LOCAL, and Site\TYPE_UNKNOWN.

Referenced by __construct().

◆ reset()

SiteSQLStore::reset ( )

Purges the internal and external cache of the site list, forcing the list of sites to be re-read from the database.

Since
1.21

Definition at line 374 of file SiteSQLStore.php.

References $cache, getCacheKey(), wfGetMainCache(), wfProfileIn(), and wfProfileOut().

Referenced by clear(), and saveSites().

◆ saveSite()

SiteSQLStore::saveSite ( Site  $site)
See also
SiteStore::saveSite
Since
1.21
Parameters
Site$site
Returns
boolean Success indicator

Implements SiteStore.

Definition at line 288 of file SiteSQLStore.php.

References array(), and saveSites().

◆ saveSites()

SiteSQLStore::saveSites ( array  $sites)
See also
SiteStore::saveSites
Since
1.21
Parameters
Site[]$sites
Returns
boolean Success indicator

Implements SiteStore.

Definition at line 301 of file SiteSQLStore.php.

References $sites, $success, array(), as, getRowFromSite(), reset(), wfProfileIn(), and wfProfileOut().

Referenced by saveSite().

◆ siteFromRow()

SiteSQLStore::siteFromRow ( ORMRow  $siteRow)
protected

Returns a new Site object constructed from the provided ORMRow.

Since
1.21
Parameters
ORMRow$siteRow
Returns
Site

Definition at line 150 of file SiteSQLStore.php.

References ORMRow\getField(), ORMRow\hasField(), Site\newForType(), Site\TYPE_UNKNOWN, wfProfileIn(), and wfProfileOut().

Referenced by loadSites().

Member Data Documentation

◆ $cacheKey

string null SiteSQLStore::$cacheKey = null
private

Definition at line 45 of file SiteSQLStore.php.

Referenced by getCacheKey().

◆ $cacheTimeout

int SiteSQLStore::$cacheTimeout = 3600
private

Definition at line 49 of file SiteSQLStore.php.

◆ $sites

SiteList null SiteSQLStore::$sites = null
protected
Since
1.21

Definition at line 37 of file SiteSQLStore.php.

Referenced by getSite(), getSites(), and saveSites().

◆ $sitesTable

ORMTable SiteSQLStore::$sitesTable
protected

Definition at line 41 of file SiteSQLStore.php.

Referenced by __construct(), and newInstance().


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