Merge "Selenium: replace UserLoginPage with BlankPage where possible"
[lhc/web/wiklou.git] / includes / interwiki / InterwikiLookup.php
1 <?php
2
3 namespace MediaWiki\Interwiki;
4
5 /**
6 * Service interface for looking up Interwiki records.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 * http://www.gnu.org/copyleft/gpl.html
22 *
23 * @file
24 */
25 use Interwiki;
26
27 /**
28 * Service interface for looking up Interwiki records.
29 *
30 * @since 1.28
31 */
32 interface InterwikiLookup {
33
34 /**
35 * Check whether an interwiki prefix exists
36 *
37 * @param string $prefix Interwiki prefix to use
38 * @return bool Whether it exists
39 */
40 public function isValidInterwiki( $prefix );
41
42 /**
43 * Fetch an Interwiki object
44 *
45 * @param string $prefix Interwiki prefix to use
46 * @return Interwiki|null|bool
47 */
48 public function fetch( $prefix );
49
50 /**
51 * Returns information about all interwiki prefixes, in the form of rows
52 * of the interwiki table. Each row may have the following keys:
53 *
54 * - iw_prefix: the prefix. Always present.
55 * - iw_url: the URL to use for linking, with $1 as a placeholder for the target page.
56 * Always present.
57 * - iw_api: the URL of the API. Optional.
58 * - iw_wikiid: the wiki ID (usually the database name for local wikis). Optional.
59 * - iw_local: whether the wiki is local, and the "magic redirect" mechanism should apply.
60 * Defaults to false.
61 * - iw_trans: whether "scary transclusion" is allowed for this site.
62 * Defaults to false.
63 *
64 * @param string|null $local If set, limits output to local/non-local interwikis
65 * @return array[] interwiki rows.
66 */
67 public function getAllPrefixes( $local = null );
68
69 /**
70 * Purge the in-process and persistent object cache for an interwiki prefix
71 * @param string $prefix
72 */
73 public function invalidateCache( $prefix );
74
75 }