37 public static function getWiki( $wikiID ) {
39 if ( $wikiReference ) {
40 return $wikiReference;
56 list( $major, $minor ) =
$wgConf->siteFromDB( $wikiID );
57 if ( $major ===
null ) {
60 $server =
$wgConf->get(
'wgServer', $wikiID, $major,
61 [
'lang' => $minor,
'site' => $major ] );
63 $canonicalServer =
$wgConf->get(
'wgCanonicalServer', $wikiID, $major,
64 [
'lang' => $minor,
'site' => $major ] );
65 if ( $canonicalServer ===
false || $canonicalServer ===
null ) {
66 $canonicalServer = $server;
69 $path =
$wgConf->get(
'wgArticlePath', $wikiID, $major,
70 [
'lang' => $minor,
'site' => $major ] );
75 if ( !is_string( $canonicalServer ) || !is_string( $path ) || strpos( $path,
'$1' ) ===
false ) {
87 $siteLookup = MediaWikiServices::getInstance()->getSiteLookup();
88 $site = $siteLookup->getSite( $wikiID );
96 if ( $urlParts ===
false || !isset( $urlParts[
'path'] ) || !isset( $urlParts[
'host'] ) ) {
102 $path = $urlParts[
'path'];
103 if ( isset( $urlParts[
'query'] ) ) {
104 $path .=
'?' . $urlParts[
'query'];
107 $canonicalServer = isset( $urlParts[
'scheme'] ) ? $urlParts[
'scheme'] :
'http';
108 $canonicalServer .=
'://' . $urlParts[
'host'];
124 return $wiki->getDisplayName();
155 if ( $url ===
false ) {
171 public static function getForeignURL( $wikiID, $page, $fragmentId =
null ) {
175 return $wiki->getFullUrl( $page, $fragmentId );
188 $cache = MediaWikiServices::getInstance()->getLocalServerObjectCache();
190 return $cache->getWithSetCallback(
191 $cache->makeGlobalKey(
'wikimap',
'canonical-urls' ),
206 if ( $wikiReference ) {
207 $url = $wikiReference->getCanonicalServer();
208 $infoMap[$wikiId] = [
'url' => $url,
'parts' =>
wfParseUrl( $url ) ];
224 if ( $urlPartsCheck ===
false ) {
228 $urlPartsCheck = array_intersect_key( $urlPartsCheck, [
'host' => 1,
'port' => 1 ] );
229 foreach ( self::getCanonicalServerInfoForAllWikis() as $wikiId => $info ) {
230 $urlParts = $info[
'parts'];
231 if ( $urlParts ===
false ) {
235 $urlParts = array_intersect_key( $urlParts, [
'host' => 1,
'port' => 1 ] );
236 if ( $urlParts == $urlPartsCheck ) {
254 $domain = DatabaseDomain::newFromId( $domain );
257 return strlen( $domain->getTablePrefix() )
258 ?
"{$domain->getDatabase()}-{$domain->getTablePrefix()}"
259 : $domain->getDatabase();
268 $domain = DatabaseDomain::newFromId( $domain );
271 if ( !in_array( $curDomain->getSchema(), [
null,
'mediawiki' ],
true ) ) {
276 return $curDomain->equals( $domain );
280 $curDomain->getDatabase() === $domain->getDatabase() &&
281 $curDomain->getTablePrefix() === $domain->getTablePrefix()
$wgDBprefix
Table name prefix.
$wgLocalDatabases
Other wikis on this site, can be administered from a single developer account.
$wgDBmwschema
Mediawiki schema.
$wgConf
wgConf hold the site configuration.
$wgCanonicalServer
Canonical URL of the server, to use in IRC feeds and notification e-mails.
wfParseUrl( $url)
parse_url() work-alike, but non-broken.
wfWikiID()
Get an ASCII string identifying this wiki This is used as a prefix in memcached keys.
static makeExternalLink( $url, $text, $escape=true, $linktype='', $attribs=[], $title=null)
Make an external link.
Helper tools for dealing with other locally-hosted wikis.
static getWikiWikiReferenceFromSites( $wikiID)
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 getWikiReferenceFromWgConf( $wikiID)
static getWikiName( $wikiID)
Convenience to get the wiki's display name.
static getCurrentWikiDbDomain()
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.
static isCurrentWikiDbDomain( $domain)
Reference to a locally-hosted wiki.
Class to handle database/prefix specification for IDatabase domains.
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
when a variable name is used in a function
controlled by $wgMainCacheType controlled by $wgParserCacheType controlled by $wgMessageCacheType If you set CACHE_NONE to one of the three control default value for MediaWiki still create a but requests to it are no ops and we always fall through to the database If the cache daemon can t be it should also disable itself fairly smoothly By $wgMemc is used but when it is $parserMemc or $messageMemc this is mentioned $wgDBname