Go to the documentation of this file.
29 class Site implements Serializable {
158 throw new MWException(
'$globalId needs to be string or null' );
196 if ( !is_string(
$group ) ) {
197 throw new MWException(
'$group needs to be a string' );
225 throw new MWException(
'$source needs to be a string' );
253 public function setForward( $shouldForward ) {
254 if ( !is_bool( $shouldForward ) ) {
255 throw new MWException(
'$shouldForward needs to be a boolean' );
258 $this->forward = $shouldForward;
272 if (
$path ===
null ) {
276 return parse_url(
$path, PHP_URL_HOST );
290 if (
$path ===
null ) {
294 $protocol = parse_url(
$path, PHP_URL_SCHEME );
297 if ( $protocol ===
false ) {
298 throw new MWException(
"failed to parse URL '$path'" );
302 if ( $protocol ===
null ) {
323 if (
$type ===
null ) {
324 throw new MWException(
"This Site does not support link paths." );
372 public function getPageUrl( $pageName =
false ) {
375 if ( $url ===
false ) {
379 if ( $pageName !==
false ) {
380 $url = str_replace(
'$1', rawurlencode( $pageName ), $url );
501 if ( $this->localIds ===
false ) {
502 $this->localIds =
array();
505 if ( !array_key_exists(
$type, $this->localIds ) ) {
509 if ( !in_array( $identifier, $this->localIds[
$type] ) ) {
510 $this->localIds[
$type][] = $identifier;
544 return array_key_exists( self::ID_INTERWIKI, $this->localIds ) ? $this->localIds[
self::ID_INTERWIKI] :
array();
581 public function setPath( $pathType, $fullUrl ) {
582 if ( !is_string( $fullUrl ) ) {
583 throw new MWException(
'$fullUrl needs to be a string' );
586 if ( !array_key_exists(
'paths', $this->extraData ) ) {
587 $this->extraData[
'paths'] =
array();
590 $this->extraData[
'paths'][$pathType] = $fullUrl;
602 public function getPath( $pathType ) {
604 return array_key_exists( $pathType, $paths ) ? $paths[$pathType] :
null;
616 return array_key_exists(
'paths', $this->extraData ) ? $this->extraData[
'paths'] :
array();
627 if ( array_key_exists(
'paths', $this->extraData ) ) {
628 unset( $this->extraData[
'paths'][$pathType] );
639 public static function newForType( $siteType ) {
642 if ( array_key_exists( $siteType, $wgSiteTypes ) ) {
643 return new $wgSiteTypes[$siteType]();
658 'globalid' => $this->globalId,
659 'type' => $this->
type,
660 'group' => $this->group,
661 'source' => $this->
source,
662 'language' => $this->languageCode,
663 'localids' => $this->localIds,
664 'config' => $this->extraConfig,
665 'data' => $this->extraData,
666 'forward' => $this->forward,
667 'internalid' => $this->internalId,
687 $this->
setGroup( $fields[
'group'] );
690 $this->localIds = $fields[
'localids'];
getInterwikiIds()
Returns the interwiki link identifiers that can be used for this site.
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
getType()
Returns the type of the site (ie mediawiki).
getDomain()
Returns the domain of the site, ie en.wikipedia.org Or false if it's not known.
string null $languageCode
setSource( $source)
Sets the source of the site data (ie 'local', 'wikidata', 'my-magical-repo').
getPageUrl( $pageName=false)
Returns the full URL for the given page on the site.
getInternalId()
Returns the set internal identifier for the site.
setLinkPath( $fullUrl)
Sets the path used to construct links with.
foreach( $res as $row) $serialized
setGroup( $group)
Sets the type of the site (ie wikipedia).
setInternalId( $internalId=null)
Sets the internal identifier for the site.
getPath( $pathType)
Returns the path of the provided type or false if there is no such path.
getLanguageCode()
Returns language code of the sites primary language.
static newForType( $siteType)
__construct( $type=self::TYPE_UNKNOWN)
Constructor.
getGlobalId()
Returns the global site identifier (ie enwiktionary).
getSource()
Returns the source of the site data (ie 'local', 'wikidata', 'my-magical-repo').
setForward( $shouldForward)
Sets if site.tld/path/key:pageTitle should forward users to the page on the actual site,...
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
setLanguageCode( $languageCode)
Sets language code of the sites primary language.
getGroup()
Gets the type of the site (ie wikipedia).
when a variable name is used in a it is silently declared as a new masking the global
addInterwikiId( $identifier)
Adds an interwiki id to the site.
addLocalId( $type, $identifier)
Adds a local identifier.
unserialize( $serialized)
getLinkPathType()
Returns the main path type, that is the type of the path that should generally be used to construct l...
array[] $localIds
Holds the local ids for this site.
setExtraData(array $extraData)
Sets the type specific fields.
addNavigationId( $identifier)
Adds a navigation id to the site.
setPath( $pathType, $fullUrl)
Sets the path used to construct links with.
getNavigationIds()
Returns the equivalent link identifiers that can be used to make the site show up in interfaces such ...
getExtraConfig()
Returns the type specific config.
getAllPaths()
Returns the paths as associative array.
removePath( $pathType)
Removes the path of the provided type if it's set.
This document describes the state of Postgres support in and is fairly well maintained The main code is very well while extensions are very hit and miss it is probably the most supported database after MySQL Much of the work in making MediaWiki database agnostic came about through the work of creating Postgres as and are nearing end of but without copying over all the usage comments General notes on the but these can almost always be programmed around *Although Postgres has a true BOOLEAN type
setExtraConfig(array $extraConfig)
Sets the type specific config.
setGlobalId( $globalId)
Sets the global site identifier (ie enwiktionary).
normalizePageName( $pageName)
Returns $pageName without changes.
shouldForward()
Gets if site.tld/path/key:pageTitle should forward users to the page on the actual site,...
return true to allow those checks to and false if checking is done use this to change the tables headers temp or archived zone change it to an object instance and return false override the list derivative used the name of the old file when set the default code will be skipped add a value to it if you want to add a cookie that have to vary cache options can modify source
getProtocol()
Returns the protocol of the site.
getExtraData()
Returns the type specific fields.
getLinkPath()
Returns the path used to construct links with or false if there is no such path.
getLocalIds()
Returns all local ids.