3 namespace MediaWiki\Interwiki
;
6 * Service interface for looking up Interwiki records.
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.
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.
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
28 * Service interface for looking up Interwiki records.
32 interface InterwikiLookup
{
35 * Check whether an interwiki prefix exists
37 * @param string $prefix Interwiki prefix to use
38 * @return bool Whether it exists
40 public function isValidInterwiki( $prefix );
43 * Fetch an Interwiki object
45 * @param string $prefix Interwiki prefix to use
46 * @return Interwiki|null|bool
48 public function fetch( $prefix );
51 * Returns information about all interwiki prefixes, in the form of rows
52 * of the interwiki table. Each row may have the following keys:
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.
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.
61 * - iw_trans: whether "scary transclusion" is allowed for this site.
64 * @param string|null $local If set, limits output to local/non-local interwikis
65 * @return array[] interwiki rows.
67 public function getAllPrefixes( $local = null );
70 * Purge the in-process and persistent object cache for an interwiki prefix
71 * @param string $prefix
73 public function invalidateCache( $prefix );