MediaWiki  1.32.5
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

◆ __construct()

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

Definition at line 48 of file FileBasedSiteLookup.php.

References $cacheFile.

Member Function Documentation

◆ getSite()

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

Implements SiteLookup.

Definition at line 72 of file FileBasedSiteLookup.php.

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

◆ getSites()

FileBasedSiteLookup::getSites ( )
Since
1.25
Returns
SiteList

Implements SiteLookup.

Definition at line 57 of file FileBasedSiteLookup.php.

References $sites, and loadSitesFromCache().

Referenced by getSite().

◆ loadJsonFile()

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().

◆ loadSitesFromCache()

FileBasedSiteLookup::loadSitesFromCache ( )
private
Returns
SiteList

Definition at line 81 of file FileBasedSiteLookup.php.

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

Referenced by getSites().

◆ newSiteFromArray()

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

◆ $cacheFile

string FileBasedSiteLookup::$cacheFile
private

Definition at line 43 of file FileBasedSiteLookup.php.

Referenced by __construct().

◆ $sites

SiteList FileBasedSiteLookup::$sites = null
private

Definition at line 38 of file FileBasedSiteLookup.php.

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


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