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