MediaWiki master
MediaWiki\WikiMap\WikiMap Class Reference

Tools for dealing with other locally-hosted wikis. More...

Static Public Member Functions

static foreignUserLink ( $wikiID, $user, $text=null)
 Convenience to get a link to a user page on a foreign wiki.
 
static getCanonicalServerInfoForAllWikis ()
 Get canonical server info for all local wikis in the map that have one.
 
static getCurrentWikiDbDomain ()
 
static getCurrentWikiId ()
 
static getForeignURL ( $wikiID, $page, $fragmentId=null)
 Convenience to get a url to a page on a foreign wiki.
 
static getWiki ( $wikiID)
 Get a WikiReference object for $wikiID.
 
static getWikiFromUrl ( $url)
 
static getWikiIdFromDbDomain ( $domain)
 Get the wiki ID of a database domain.
 
static getWikiName ( $wikiID)
 Convenience to get the wiki's display name.
 
static isCurrentWikiDbDomain ( $domain)
 
static isCurrentWikiId ( $wikiId)
 
static makeForeignLink ( $wikiID, $page, $text=null)
 Convenience to get a link to a page on a foreign wiki.
 

Detailed Description

Tools for dealing with other locally-hosted wikis.

Definition at line 31 of file WikiMap.php.

Member Function Documentation

◆ foreignUserLink()

static MediaWiki\WikiMap\WikiMap::foreignUserLink ( $wikiID,
$user,
$text = null )
static

Convenience to get a link to a user page on a foreign wiki.

Parameters
string$wikiIDWiki'd id (generally database name)
string$userUser name (must be normalised before calling this function!)
string | null$textLink's text; optional, default to "User:$user"
Returns
string HTML link or false if the wiki was not found

Definition at line 139 of file WikiMap.php.

References MediaWiki\WikiMap\WikiMap\makeForeignLink().

◆ getCanonicalServerInfoForAllWikis()

static MediaWiki\WikiMap\WikiMap::getCanonicalServerInfoForAllWikis ( )
static

Get canonical server info for all local wikis in the map that have one.

Returns
array[] Map of (local wiki ID => map of (url,parts))
Since
1.30

Definition at line 196 of file WikiMap.php.

References $url, $wgCanonicalServer, $wgLocalDatabases, MediaWiki\WikiMap\WikiMap\getCurrentWikiId(), MediaWiki\MediaWikiServices\getInstance(), MediaWiki\WikiMap\WikiMap\getWiki(), and wfParseUrl().

◆ getCurrentWikiDbDomain()

static MediaWiki\WikiMap\WikiMap::getCurrentWikiDbDomain ( )
static
Returns
DatabaseDomain Database domain of the current wiki
Since
1.33

Definition at line 301 of file WikiMap.php.

References $wgDBmwschema, $wgDBname, and $wgDBprefix.

Referenced by MediaWiki\WikiMap\WikiMap\isCurrentWikiDbDomain().

◆ getCurrentWikiId()

static MediaWiki\WikiMap\WikiMap::getCurrentWikiId ( )
static

◆ getForeignURL()

static MediaWiki\WikiMap\WikiMap::getForeignURL ( $wikiID,
$page,
$fragmentId = null )
static

Convenience to get a url to a page on a foreign wiki.

Parameters
string$wikiIDWiki'd id (generally database name)
string$pagePage name (must be normalised before calling this function!)
string | null$fragmentId
Returns
string|false URL or false if the wiki was not found

Definition at line 179 of file WikiMap.php.

References MediaWiki\WikiMap\WikiMap\getWiki().

Referenced by MediaWiki\WikiMap\WikiMap\makeForeignLink().

◆ getWiki()

static MediaWiki\WikiMap\WikiMap::getWiki ( $wikiID)
static

Get a WikiReference object for $wikiID.

Parameters
string$wikiIDWiki'd id (generally database name)
Returns
WikiReference|null WikiReference object or null if the wiki was not found

Definition at line 39 of file WikiMap.php.

Referenced by MediaWiki\WikiMap\WikiMap\getCanonicalServerInfoForAllWikis(), MediaWiki\WikiMap\WikiMap\getForeignURL(), and MediaWiki\WikiMap\WikiMap\getWikiName().

◆ getWikiFromUrl()

static MediaWiki\WikiMap\WikiMap::getWikiFromUrl ( $url)
static
Parameters
string$url
Returns
string|false Wiki ID or false
Since
1.30

Definition at line 232 of file WikiMap.php.

References $url, $wgCanonicalServer, MediaWiki\WikiMap\WikiMap\getCurrentWikiId(), and wfParseUrl().

◆ getWikiIdFromDbDomain()

static MediaWiki\WikiMap\WikiMap::getWikiIdFromDbDomain ( $domain)
static

Get the wiki ID of a database domain.

This is like DatabaseDomain::getId() without encoding (for legacy reasons) and without the schema if it is the generic installer default of "mediawiki"

See also
$wgDBmwschema
PostgresInstaller
Parameters
string | DatabaseDomain$domain
Returns
string
Since
1.31

Definition at line 277 of file WikiMap.php.

Referenced by MediaWiki\WikiMap\WikiMap\getCurrentWikiId().

◆ getWikiName()

static MediaWiki\WikiMap\WikiMap::getWikiName ( $wikiID)
static

Convenience to get the wiki's display name.

Todo
We can give more info than just the wiki id!
Parameters
string$wikiIDWiki'd id (generally database name)
Returns
string Wiki's name or $wiki_id if the wiki was not found

Definition at line 126 of file WikiMap.php.

References MediaWiki\WikiMap\WikiMap\getWiki().

◆ isCurrentWikiDbDomain()

static MediaWiki\WikiMap\WikiMap::isCurrentWikiDbDomain ( $domain)
static
Parameters
DatabaseDomain | string$domain
Returns
bool Whether $domain matches the DB domain of the current wiki
Since
1.33

Definition at line 320 of file WikiMap.php.

References MediaWiki\WikiMap\WikiMap\getCurrentWikiDbDomain().

◆ isCurrentWikiId()

static MediaWiki\WikiMap\WikiMap::isCurrentWikiId ( $wikiId)
static
Parameters
string$wikiId
Returns
bool Whether $wikiId matches the wiki ID of the current wiki
Since
1.33

Definition at line 329 of file WikiMap.php.

◆ makeForeignLink()

static MediaWiki\WikiMap\WikiMap::makeForeignLink ( $wikiID,
$page,
$text = null )
static

Convenience to get a link to a page on a foreign wiki.

Parameters
string$wikiIDWiki'd id (generally database name)
string$pagePage name (must be normalised before calling this function!)
string | null$textLink's text; optional, default to $page
Returns
string|false HTML link or false if the wiki was not found

Definition at line 151 of file WikiMap.php.

References $url, $wgTitle, MediaWiki\WikiMap\WikiMap\getForeignURL(), MediaWiki\MediaWikiServices\getInstance(), and MediaWiki\SpecialPage\SpecialPage\getTitleFor().

Referenced by MediaWiki\WikiMap\WikiMap\foreignUserLink().


The documentation for this class was generated from the following file: