Add a method to clear the site list programmatically.
[lhc/web/wiklou.git] / includes / site / SiteStore.php
1 <?php
2
3 /**
4 * Interface for service objects providing a storage interface for Site objects.
5 *
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.
10 *
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.
15 *
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
20 *
21 * @since 1.21
22 *
23 * @file
24 * @ingroup Site
25 *
26 * @license GNU GPL v2+
27 * @author Jeroen De Dauw < jeroendedauw@gmail.com >
28 */
29 interface SiteStore {
30
31 /**
32 * Saves the provided site.
33 *
34 * @since 1.21
35 *
36 * @param Site $site
37 *
38 * @return boolean Success indicator
39 */
40 public function saveSite( Site $site );
41
42 /**
43 * Saves the provided sites.
44 *
45 * @since 1.21
46 *
47 * @param Site[] $sites
48 *
49 * @return boolean Success indicator
50 */
51 public function saveSites( array $sites );
52
53 /**
54 * Returns the site with provided global id, or null if there is no such site.
55 *
56 * @since 1.21
57 *
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.
61 *
62 * @return Site|null
63 */
64 public function getSite( $globalId, $source = 'cache' );
65
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.
70 *
71 * @since 1.21
72 *
73 * @param string $source either 'cache' or 'recache'.
74 * If 'cache', the values are allowed (but not obliged) to come from a cache.
75 *
76 * @return SiteList
77 */
78 public function getSites( $source = 'cache' );
79
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.
83 */
84 public function clear();
85 }