MediaWiki REL1_34
HashSiteStore Class Reference

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

Inheritance diagram for HashSiteStore:
Collaboration diagram for HashSiteStore:

Public Member Functions

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

Private Attributes

Site[] $sites = []
 

Detailed Description

In-memory SiteStore implementation, storing sites in an associative array.

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

Definition at line 32 of file HashSiteStore.php.

Constructor & Destructor Documentation

◆ __construct()

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

Definition at line 42 of file HashSiteStore.php.

References saveSites().

Member Function Documentation

◆ clear()

HashSiteStore::clear ( )

Deletes 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 SiteStore.

Definition at line 114 of file HashSiteStore.php.

◆ getSite()

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

Returns 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 89 of file HashSiteStore.php.

◆ getSites()

HashSiteStore::getSites (   $source = 'cache')

Returns a list of all sites.

By default this site 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 105 of file HashSiteStore.php.

◆ saveSite()

HashSiteStore::saveSite ( Site  $site)

Saves the provided site.

Since
1.25
Parameters
Site$site
Returns
bool Success indicator

Implements SiteStore.

Definition at line 55 of file HashSiteStore.php.

References Site\getGlobalId().

Referenced by saveSites().

◆ saveSites()

HashSiteStore::saveSites ( array  $sites)

Saves the provided sites.

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

Implements SiteStore.

Definition at line 70 of file HashSiteStore.php.

References $sites, and saveSite().

Referenced by __construct().

Member Data Documentation

◆ $sites

Site [] HashSiteStore::$sites = []
private

Definition at line 37 of file HashSiteStore.php.

Referenced by saveSites().


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