MediaWiki
1.34.0
HashSiteStore.php
Go to the documentation of this file.
1
<?php
32
class
HashSiteStore
implements
SiteStore
{
33
37
private
$sites
= [];
38
42
public
function
__construct
(
$sites
= [] ) {
43
$this->
saveSites
(
$sites
);
44
}
45
55
public
function
saveSite
(
Site
$site ) {
56
$this->sites[$site->
getGlobalId
()] = $site;
57
58
return
true
;
59
}
60
70
public
function
saveSites
( array
$sites
) {
71
foreach
(
$sites
as $site ) {
72
$this->
saveSite
( $site );
73
}
74
75
return
true
;
76
}
77
89
public
function
getSite
( $globalId,
$source
=
'cache'
) {
90
return
$this->sites[$globalId] ??
null
;
91
}
92
105
public
function
getSites
(
$source
=
'cache'
) {
106
return
new
SiteList
( $this->sites );
107
}
108
114
public
function
clear
() {
115
$this->sites = [];
116
117
return
true
;
118
}
119
120
}
HashSiteStore\getSite
getSite( $globalId, $source='cache')
Returns the site with provided global id, or null if there is no such site.
Definition:
HashSiteStore.php:89
HashSiteStore\__construct
__construct( $sites=[])
Definition:
HashSiteStore.php:42
HashSiteStore\saveSite
saveSite(Site $site)
Saves the provided site.
Definition:
HashSiteStore.php:55
HashSiteStore\clear
clear()
Deletes all sites from the database.
Definition:
HashSiteStore.php:114
HashSiteStore\getSites
getSites( $source='cache')
Returns a list of all sites.
Definition:
HashSiteStore.php:105
SiteStore
Definition:
SiteStore.php:29
Site\getGlobalId
getGlobalId()
Returns the global site identifier (ie enwiktionary).
Definition:
Site.php:140
SiteList
Definition:
SiteList.php:29
HashSiteStore
In-memory SiteStore implementation, storing sites in an associative array.
Definition:
HashSiteStore.php:32
Site
Definition:
Site.php:29
HashSiteStore\saveSites
saveSites(array $sites)
Saves the provided sites.
Definition:
HashSiteStore.php:70
HashSiteStore\$sites
Site[] $sites
Definition:
HashSiteStore.php:37
$source
$source
Definition:
mwdoc-filter.php:34
includes
site
HashSiteStore.php
Generated on Thu Dec 19 2019 14:54:52 for MediaWiki by
1.8.16