Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2/**
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 * http://www.gnu.org/copyleft/gpl.html
17 *
18 * @file
19 */
20
21namespace MediaWiki\Interwiki;
22
23use Interwiki;
24
25/**
26 * Service interface for looking up Interwiki records.
27 *
28 * Default implementation is ClassicInterwikiLookup.
29 *
30 * @since 1.28
31 */
32interface InterwikiLookup {
33
34    /**
35     * Check whether an interwiki prefix exists
36     *
37     * @param string $prefix Interwiki prefix
38     * @return bool Whether it exists
39     */
40    public function isValidInterwiki( $prefix );
41
42    /**
43     * Get the Interwiki object for a given prefix
44     *
45     * @param string $prefix Interwiki prefix
46     * @return Interwiki|null|false Null for invalid, false for not found
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 bool|null $local If set, limit output to local or non-local interwikis
65     * @return array[] interwiki rows.
66     */
67    public function getAllPrefixes( $local = null );
68
69    /**
70     * Purge the in-process and any persistent cache (e.g. memcached) for an interwiki prefix.
71     *
72     * @param string $prefix
73     */
74    public function invalidateCache( $prefix );
75
76}