MediaWiki  1.28.0
FileBasedSiteLookup Class Reference

Provides a file-based cache of a SiteStore. More...

Inheritance diagram for FileBasedSiteLookup:
Collaboration diagram for FileBasedSiteLookup:

Public Member Functions

 __construct ($cacheFile)
 
 getSite ($globalId)
 
 getSites ()
 

Private Member Functions

 loadJsonFile ()
 
 loadSitesFromCache ()
 
 newSiteFromArray (array $data)
 

Private Attributes

string $cacheFile
 
SiteList $sites = null
 

Detailed Description

Provides a file-based cache of a SiteStore.

The sites are stored in a json file. (see docs/sitescache.txt regarding format)

The cache can be built with the rebuildSitesCache.php maintenance script, and a MediaWiki instance can be setup to use this by setting the 'wgSitesCacheFile' configuration to the cache file location.

Since
1.25

Definition at line 33 of file FileBasedSiteLookup.php.

Constructor & Destructor Documentation

FileBasedSiteLookup::__construct (   $cacheFile)
Parameters
string$cacheFile

Definition at line 48 of file FileBasedSiteLookup.php.

References $cacheFile.

Member Function Documentation

FileBasedSiteLookup::getSite (   $globalId)
Parameters
string$globalId
Since
1.25
Returns
Site|null

Implements SiteLookup.

Definition at line 72 of file FileBasedSiteLookup.php.

References SiteList\getSite(), getSites(), and SiteList\hasSite().

FileBasedSiteLookup::getSites ( )
Since
1.25
Returns
SiteList

Implements SiteLookup.

Definition at line 57 of file FileBasedSiteLookup.php.

References $sites, and loadSitesFromCache().

Referenced by getSite().

FileBasedSiteLookup::loadJsonFile ( )
private
Exceptions
MWException
Returns
array see docs/sitescache.txt for format of the array.

Definition at line 98 of file FileBasedSiteLookup.php.

Referenced by loadSitesFromCache().

FileBasedSiteLookup::loadSitesFromCache ( )
private
Returns
SiteList

Definition at line 81 of file FileBasedSiteLookup.php.

References $sites, as, loadJsonFile(), and newSiteFromArray().

Referenced by getSites().

FileBasedSiteLookup::newSiteFromArray ( array  $data)
private
Parameters
array$data
Returns
Site

Definition at line 120 of file FileBasedSiteLookup.php.

References as, Site\newForType(), and Site\TYPE_UNKNOWN.

Referenced by loadSitesFromCache().

Member Data Documentation

string FileBasedSiteLookup::$cacheFile
private

Definition at line 43 of file FileBasedSiteLookup.php.

Referenced by __construct().

SiteList FileBasedSiteLookup::$sites = null
private

Definition at line 38 of file FileBasedSiteLookup.php.

Referenced by getSites(), and loadSitesFromCache().


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