17 'enwiki' =>
'http://en.example.org',
18 'ruwiki' =>
'//ru.example.org',
19 'nopathwiki' =>
'//nopath.example.org',
20 'thiswiki' =>
'//this.wiki.org'
24 'ruwiki' =>
'/wiki/$1',
27 $conf->suffixes = [
'wiki' ];
30 'wgLocalDatabases' => [
'enwiki',
'ruwiki',
'nopathwiki' ],
31 'wgCanonicalServer' =>
'//this.wiki.org',
32 'wgDBname' =>
'thiswiki',
41 $enwiki =
new WikiReference(
'http://en.example.org',
'/w/$1' );
42 $ruwiki =
new WikiReference(
'//ru.example.org',
'/wiki/$1' );
45 $nlwiki =
new WikiReference(
'https://nl.wikipedia.org',
'/wiki/$1' );
47 $enwiktionary =
new WikiReference(
'https://en.wiktionary.org',
'/wiki/$1' );
50 'unknown' => [
null,
'xyzzy' ],
51 'enwiki (wgConf)' => [ $enwiki,
'enwiki' ],
52 'ruwiki (wgConf)' => [ $ruwiki,
'ruwiki' ],
53 'nlwiki (sites)' => [ $nlwiki,
'nlwiki',
false ],
54 'enwiktionary (sites)' => [ $enwiktionary,
'enwiktionary',
false ],
55 'non MediaWiki site' => [
null,
'spam',
false ],
56 'boguswiki' => [
null,
'boguswiki' ],
57 'nopathwiki' => [
null,
'nopathwiki' ],
64 public function testGetWiki( $expected, $wikiId, $useWgConf =
true ) {
76 'unknown' => [
'xyzzy',
'xyzzy' ],
77 'enwiki' => [
'en.example.org',
'enwiki' ],
78 'ruwiki' => [
'ru.example.org',
'ruwiki' ],
79 'enwiktionary (sites)' => [
'en.wiktionary.org',
'enwiktionary' ],
92 'unknown' => [
false,
'xyzzy',
'Foo' ],
94 '<a class="external" rel="nofollow" ' .
95 'href="http://en.example.org/w/Foo">Foo</a>',
100 '<a class="external" rel="nofollow" ' .
101 'href="//ru.example.org/wiki/%D0%A4%D1%83">вар</a>',
106 'enwiktionary (sites)' => [
107 '<a class="external" rel="nofollow" ' .
108 'href="https://en.wiktionary.org/wiki/Kitten">Kittens!</a>',
128 'unknown' => [
false,
'xyzzy',
'Foo' ],
130 '<a class="external" rel="nofollow" ' .
131 'href="http://en.example.org/w/User:Foo">User:Foo</a>',
136 '<a class="external" rel="nofollow" ' .
137 'href="//ru.example.org/wiki/User:%D0%A4%D1%83">вар</a>',
142 'enwiktionary (sites)' => [
143 '<a class="external" rel="nofollow" ' .
144 'href="https://en.wiktionary.org/wiki/User:Dummy">Whatever</a>',
161 'unknown' => [
false,
'xyzzy',
'Foo' ],
162 'enwiki' => [
'http://en.example.org/w/Foo',
'enwiki',
'Foo' ],
163 'enwiktionary (sites)' => [
164 'https://en.wiktionary.org/wiki/Testme',
168 'ruwiki with fragment' => [
169 '//ru.example.org/wiki/%D0%A4%D1%83#%D0%B2%D0%B0%D1%80',
190 'url' =>
'//this.wiki.org',
191 'parts' => [
'scheme' =>
'',
'host' =>
'this.wiki.org',
'delimiter' =>
'//' ]
194 'url' =>
'http://en.example.org',
196 'scheme' =>
'http',
'host' =>
'en.example.org',
'delimiter' =>
'://' ]
199 'url' =>
'//ru.example.org',
200 'parts' => [
'scheme' =>
'',
'host' =>
'ru.example.org',
'delimiter' =>
'//' ]
214 [
'http://this.wiki.org',
'thiswiki' ],
215 [
'https://this.wiki.org',
'thiswiki' ],
216 [
'http://this.wiki.org/$1',
'thiswiki' ],
217 [
'https://this.wiki.org/$2',
'thiswiki' ],
218 [
'http://en.example.org',
'enwiki' ],
219 [
'https://en.example.org',
'enwiki' ],
220 [
'http://en.example.org/$1',
'enwiki' ],
221 [
'https://en.example.org/$2',
'enwiki' ],
222 [
'http://ru.example.org',
'ruwiki' ],
223 [
'https://ru.example.org',
'ruwiki' ],
224 [
'http://ru.example.org/$1',
'ruwiki' ],
225 [
'https://ru.example.org/$2',
'ruwiki' ],
226 [
'http://not.defined.org',
false ]
248 [
'db-prefix',
'db-prefix' ],
250 [
new DatabaseDomain(
'db-dash',
null,
'prefix' ),
'db-dash-prefix' ]
wfWikiID()
Get an ASCII string identifying this wiki This is used as a prefix in memcached keys.
This is a class for holding configuration settings, particularly for multi-wiki sites.
static insertIntoDb()
Inserts sites into the database for the unit tests that need them.
testGetForeignURL( $expected, $wikiId, $page, $fragment=null)
provideGetForeignURL
testGetWikiIdFromDomain( $domain, $wikiId)
provideGetWikiIdFromDomain WikiMap::getWikiIdFromDomain()
testGetCanonicalServerInfoForAllWikis()
WikiMap::getCanonicalServerInfoForAllWikis()
testMakeForeignLink( $expected, $wikiId, $page, $text=null)
provideMakeForeignLink
testGetWikiName( $expected, $wikiId)
provideGetWikiName
testGetWiki( $expected, $wikiId, $useWgConf=true)
provideGetWiki
provideGetWikiIdFromDomain()
testGetWikiFromUrl( $url, $wiki)
provideGetWikiFromUrl WikiMap::getWikiFromUrl()
testForeignUserLink( $expected, $wikiId, $user, $text=null)
provideForeignUserLink
static makeForeignLink( $wikiID, $page, $text=null)
Convenience to get a link to a page on a foreign wiki.
static getCanonicalServerInfoForAllWikis()
Get canonical server info for all local wikis in the map that have one.
static getWiki( $wikiID)
Get a WikiReference object for $wikiID.
static getWikiName( $wikiID)
Convenience to get the wiki's display name.
static getWikiIdFromDomain( $domain)
Get the wiki ID of a database domain.
static foreignUserLink( $wikiID, $user, $text=null)
Convenience to get a link to a user page on a foreign wiki.
static getWikiFromUrl( $url)
static getForeignURL( $wikiID, $page, $fragmentId=null)
Convenience to get a url to a page on a foreign wiki.
Reference to a locally-hosted wiki.
Class to handle database/prefix specification for IDatabase domains.
processing should stop and the error should be shown to the user * false