Merge "Typo fix"
[mediawiki.git] / includes / site / SiteStore.php
blob52ba8fbffe548e5080eb94dda3d762dfed85f2be
1 <?php
3 /**
4 * Interface for service objects providing a storage interface for Site objects.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 * http://www.gnu.org/copyleft/gpl.html
21 * @since 1.21
23 * @file
24 * @ingroup Site
26 * @license GNU GPL v2+
27 * @author Jeroen De Dauw < jeroendedauw@gmail.com >
29 interface SiteStore {
31 /**
32 * Saves the provided site.
34 * @since 1.21
36 * @param Site $site
38 * @return boolean Success indicator
40 public function saveSite( Site $site );
42 /**
43 * Saves the provided sites.
45 * @since 1.21
47 * @param Site[] $sites
49 * @return boolean Success indicator
51 public function saveSites( array $sites );
53 /**
54 * Returns the site with provided global id, or null if there is no such site.
56 * @since 1.21
58 * @param string $globalId
59 * @param string $source either 'cache' or 'recache'.
60 * If 'cache', the values are allowed (but not obliged) to come from a cache.
62 * @return Site|null
64 public function getSite( $globalId, $source = 'cache' );
66 /**
67 * Returns a list of all sites. By default this site is
68 * fetched from the cache, which can be changed to loading
69 * the list from the database using the $useCache parameter.
71 * @since 1.21
73 * @param string $source either 'cache' or 'recache'.
74 * If 'cache', the values are allowed (but not obliged) to come from a cache.
76 * @return SiteList
78 public function getSites( $source = 'cache' );
80 /**
81 * Deletes all sites from the database. After calling clear(), getSites() will return an empty
82 * list and getSite() will return null until saveSite() or saveSites() is called.
84 public function clear();