MediaWiki master
MediaWiki\Site\HashSiteStore Class Reference

In-memory SiteStore implementation, stored in an associative array. More...

Inherits MediaWiki\Site\SiteStore.

Collaboration diagram for MediaWiki\Site\HashSiteStore:

Public Member Functions

 __construct (array $sites=[])
 
 clear ()
 Delete all sites from the database.
 
 getSite ( $globalId, $source='cache')
 Return the site with provided global ID, or null if there is no such site.
 
 getSites ( $source='cache')
 Return a list of all sites.
 
 saveSite (Site $site)
 Save the provided site.
 
 saveSites (array $sites)
 Save the provided sites.
 
- Public Member Functions inherited from MediaWiki\Site\SiteLookup
 getSite ( $globalId)
 Return the site with provided global ID, or null if there is no such site.
 
 getSites ()
 Return a list of all sites.
 

Detailed Description

In-memory SiteStore implementation, stored in an associative array.

Since
1.25
Author
Daniel Kinzler
Katie Filbert < aude..nosp@m.wiki.nosp@m.@gmai.nosp@m.l.co.nosp@m.m >

Definition at line 31 of file HashSiteStore.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Site\HashSiteStore::__construct ( array $sites = [])
Parameters
Site[]$sites

Definition at line 38 of file HashSiteStore.php.

References MediaWiki\Site\HashSiteStore\saveSites().

Member Function Documentation

◆ clear()

MediaWiki\Site\HashSiteStore::clear ( )

Delete all sites from the database.

After calling clear(), getSites() will return an empty list and getSite() will return null until saveSite() or saveSites() is called.

Returns
bool

Implements MediaWiki\Site\SiteStore.

Definition at line 106 of file HashSiteStore.php.

◆ getSite()

MediaWiki\Site\HashSiteStore::getSite ( $globalId,
$source = 'cache' )

Return the site with provided global ID, or null if there is no such site.

Since
1.25
Parameters
string$globalId
string$sourceeither 'cache' or 'recache'. If 'cache', the values can (but not obliged) come from a cache.
Returns
Site|null

Definition at line 79 of file HashSiteStore.php.

◆ getSites()

MediaWiki\Site\HashSiteStore::getSites ( $source = 'cache')

Return a list of all sites.

By default this list is fetched from the cache, which can be changed to loading the list from the database using the $useCache parameter.

Since
1.25
Parameters
string$sourceeither 'cache' or 'recache'. If 'cache', the values can (but not obliged) come from a cache.
Returns
SiteList

Definition at line 94 of file HashSiteStore.php.

◆ saveSite()

MediaWiki\Site\HashSiteStore::saveSite ( Site $site)

Save the provided site.

Since
1.25
Parameters
Site$site
Returns
bool Success indicator

Implements MediaWiki\Site\SiteStore.

Definition at line 49 of file HashSiteStore.php.

References MediaWiki\Site\Site\getGlobalId().

Referenced by MediaWiki\Site\HashSiteStore\saveSites().

◆ saveSites()

MediaWiki\Site\HashSiteStore::saveSites ( array $sites)

Save the provided sites.

Since
1.25
Parameters
Site[]$sites
Returns
bool Success indicator

Implements MediaWiki\Site\SiteStore.

Definition at line 62 of file HashSiteStore.php.

References MediaWiki\Site\HashSiteStore\saveSite().

Referenced by MediaWiki\Site\HashSiteStore\__construct().


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