MediaWiki  1.32.5
WikiMap Class Reference

Helper 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. More...
 
static getCanonicalServerInfoForAllWikis ()
 Get canonical server info for all local wikis in the map that have one. More...
 
static getCurrentWikiDbDomain ()
 
static getForeignURL ( $wikiID, $page, $fragmentId=null)
 Convenience to get a url to a page on a foreign wiki. More...
 
static getWiki ( $wikiID)
 Get a WikiReference object for $wikiID. More...
 
static getWikiFromUrl ( $url)
 
static getWikiIdFromDomain ( $domain)
 Get the wiki ID of a database domain. More...
 
static getWikiName ( $wikiID)
 Convenience to get the wiki's display name. More...
 
static isCurrentWikiDbDomain ( $domain)
 
static makeForeignLink ( $wikiID, $page, $text=null)
 Convenience to get a link to a page on a foreign wiki. More...
 

Static Private Member Functions

static getWikiReferenceFromWgConf ( $wikiID)
 
static getWikiWikiReferenceFromSites ( $wikiID)
 

Detailed Description

Helper tools for dealing with other locally-hosted wikis.

Definition at line 29 of file WikiMap.php.

Member Function Documentation

◆ foreignUserLink()

static 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 137 of file WikiMap.php.

References makeForeignLink().

Referenced by RightsLogFormatter\makePageLink(), and WikiMapTest\testForeignUserLink().

◆ getCanonicalServerInfoForAllWikis()

static 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 187 of file WikiMap.php.

References $cache, $wgCanonicalServer, $wgLocalDatabases, as, getWiki(), wfParseUrl(), and wfWikiID().

Referenced by WikiMapTest\testGetCanonicalServerInfoForAllWikis().

◆ getCurrentWikiDbDomain()

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

Definition at line 289 of file WikiMap.php.

References $wgDBmwschema, $wgDBname, and $wgDBprefix.

Referenced by isCurrentWikiDbDomain(), and JobQueueGroup\singleton().

◆ getForeignURL()

static 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|bool URL or false if the wiki was not found

Definition at line 171 of file WikiMap.php.

References getWiki().

Referenced by Linker\makeCommentLink(), makeForeignLink(), and WikiMapTest\testGetForeignURL().

◆ getWiki()

static 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 37 of file WikiMap.php.

References getWikiReferenceFromWgConf(), and getWikiWikiReferenceFromSites().

Referenced by getCanonicalServerInfoForAllWikis(), getForeignURL(), getWikiName(), and WikiMapTest\testGetWiki().

◆ getWikiFromUrl()

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

Definition at line 222 of file WikiMap.php.

References as, and wfParseUrl().

Referenced by MediaWiki\getUrlDomainDistance(), and WikiMapTest\testGetWikiFromUrl().

◆ getWikiIdFromDomain()

static WikiMap::getWikiIdFromDomain (   $domain)
static

Get the wiki ID of a database domain.

This is like DatabaseDomain::getId() without encoding (for legacy reasons)

Parameters
string | DatabaseDomain$domain
Returns
string

Definition at line 252 of file WikiMap.php.

Referenced by LinksDeletionUpdate\getAsJobSpecification(), LinksUpdate\getAsJobSpecification(), JobQueueGroup\getCachedConfigVar(), JobQueueGroup\singleton(), and WikiMapTest\testGetWikiIdFromDomain().

◆ getWikiName()

static 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|int Wiki's name or $wiki_id if the wiki was not found

Definition at line 120 of file WikiMap.php.

References getWiki().

Referenced by WikiMapTest\testGetWikiName().

◆ getWikiReferenceFromWgConf()

static WikiMap::getWikiReferenceFromWgConf (   $wikiID)
staticprivate
Parameters
string$wikiID
Returns
WikiReference|null WikiReference object or null if the wiki was not found

Definition at line 51 of file WikiMap.php.

References $path, $wgConf, and list.

Referenced by getWiki().

◆ getWikiWikiReferenceFromSites()

static WikiMap::getWikiWikiReferenceFromSites (   $wikiID)
staticprivate
Parameters
string$wikiID
Returns
WikiReference|null WikiReference object or null if the wiki was not found

Definition at line 86 of file WikiMap.php.

References $path, and wfParseUrl().

Referenced by getWiki().

◆ isCurrentWikiDbDomain()

static WikiMap::isCurrentWikiDbDomain (   $domain)
static
Parameters
DatabaseDomain | string$domain
Returns
bool Whether $domain has the same DB/prefix as the current wiki
Since
1.33

Definition at line 267 of file WikiMap.php.

References getCurrentWikiDbDomain(), and true.

Referenced by JobQueueGroup\getCachedConfigVar(), JobQueue\pop(), and JobQueueGroup\singleton().

◆ makeForeignLink()

static 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 149 of file WikiMap.php.

References getForeignURL(), and Linker\makeExternalLink().

Referenced by foreignUserLink(), and WikiMapTest\testMakeForeignLink().


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