Go to the documentation of this file.
34 public static function getWiki( $wikiID ) {
37 $wgConf->loadFullData();
39 list( $major, $minor ) = $wgConf->siteFromDB( $wikiID );
40 if ( $major ===
null ) {
43 $server = $wgConf->get(
'wgServer', $wikiID, $major,
44 array(
'lang' => $minor,
'site' => $major ) );
46 $canonicalServer = $wgConf->get(
'wgCanonicalServer', $wikiID, $major,
47 array(
'lang' => $minor,
'site' => $major ) );
48 if ( $canonicalServer ===
false || $canonicalServer ===
null ) {
49 $canonicalServer = $server;
52 $path = $wgConf->get(
'wgArticlePath', $wikiID, $major,
53 array(
'lang' => $minor,
'site' => $major ) );
68 return $wiki->getDisplayName();
99 if ( $url ===
false ) {
117 return $wiki->getFullUrl( $page );
142 $this->mMajor = $major;
143 $this->mMinor = $minor;
144 $this->mCanonicalServer = $canonicalServer;
145 $this->mPath =
$path;
146 $this->mServer = $server ===
null ? $canonicalServer : $server;
154 $prefixes =
array(
'http://',
'https://' );
155 foreach ( $prefixes
as $prefix ) {
156 if ( substr( $this->mCanonicalServer, 0, strlen( $prefix ) ) ) {
157 return substr( $this->mCanonicalServer, strlen( $prefix ) );
160 throw new MWException(
"Invalid hostname for wiki {$this->mMinor}.{$this->mMajor}" );
170 $url = $this->
getUrl(
'' );
173 return $parsed[
'host'];
188 return str_replace(
'$1', wfUrlEncode( str_replace(
' ',
'_', $page ) ), $this->mPath );
198 return $this->mCanonicalServer . $this->
getLocalUrl( $page );
226 return $this->mServer .
static foreignUserLink( $wikiID, $user, $text=null)
Convenience to get a link to a user page on a foreign wiki.
$mCanonicalServer
canonical server URL, e.g. 'https://www.mediawiki.org'
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
static getForeignURL( $wikiID, $page)
Convenience to get a url to a page on a foreign wiki.
getUrl( $page)
Alias for getCanonicalUrl(), for backwards compatibility.
static makeExternalLink( $url, $text, $escape=true, $linktype='', $attribs=array(), $title=null)
Make an external link.
wfParseUrl( $url)
parse_url() work-alike, but non-broken.
getDisplayName()
Get the the URL in a way to de displayed to the user More or less Wikimedia specific.
static getWiki( $wikiID)
Get a WikiReference object for $wikiID.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
when a variable name is used in a it is silently declared as a new masking the global
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
$mServer
server URL, may be protocol-relative, e.g. '//www.mediawiki.org'
getCanonicalUrl( $page)
Get a canonical (i.e.
static makeForeignLink( $wikiID, $page, $text=null)
Convenience to get a link to a page on a foreign wiki.
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
Helper tools for dealing with other locally-hosted wikis.
Reference to a locally-hosted wiki.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
getLocalUrl( $page)
Helper function for getUrl()
getFullUrl( $page)
Get a URL based on $wgServer, like Title::getFullURL() would produce when called locally on the wiki.
getCanonicalServer()
Get a canonical server URL.
static getWikiName( $wikiID)
Convenience to get the wiki's display name.
$mMajor
'wiki', 'wiktionary', etc
$mMinor
'en', 'meta', 'mediawiki', etc
__construct( $major, $minor, $canonicalServer, $path, $server=null)