MediaWiki REL1_28
|
Public Member Functions | |
__construct ( $type=self::TYPE_UNKNOWN) | |
Constructor. | |
addInterwikiId ( $identifier) | |
Adds an interwiki id to the site. | |
addLocalId ( $type, $identifier) | |
Adds a local identifier. | |
addNavigationId ( $identifier) | |
Adds a navigation id to the site. | |
getAllPaths () | |
Returns the paths as associative array. | |
getDomain () | |
Returns the domain of the site, ie en.wikipedia.org Or false if it's not known. | |
getExtraConfig () | |
Returns the type specific config. | |
getExtraData () | |
Returns the type specific fields. | |
getGlobalId () | |
Returns the global site identifier (ie enwiktionary). | |
getGroup () | |
Gets the group of the site (ie wikipedia). | |
getInternalId () | |
Returns the set internal identifier for the site. | |
getInterwikiIds () | |
Returns the interwiki link identifiers that can be used for this site. | |
getLanguageCode () | |
Returns language code of the sites primary language. | |
getLinkPath () | |
Returns the path used to construct links with or false if there is no such path. | |
getLinkPathType () | |
Returns the main path type, that is the type of the path that should generally be used to construct links to the target site. | |
getLocalIds () | |
Returns all local ids. | |
getNavigationIds () | |
Returns the equivalent link identifiers that can be used to make the site show up in interfaces such as the "language links" section. | |
getPageUrl ( $pageName=false) | |
Returns the full URL for the given page on the site. | |
getPath ( $pathType) | |
Returns the path of the provided type or false if there is no such path. | |
getProtocol () | |
Returns the protocol of the site. | |
getSource () | |
Returns the source of the site data (ie 'local', 'wikidata', 'my-magical-repo'). | |
getType () | |
Returns the type of the site (ie mediawiki). | |
normalizePageName ( $pageName) | |
Returns $pageName without changes. | |
removePath ( $pathType) | |
Removes the path of the provided type if it's set. | |
serialize () | |
setExtraConfig (array $extraConfig) | |
Sets the type specific config. | |
setExtraData (array $extraData) | |
Sets the type specific fields. | |
setForward ( $shouldForward) | |
Sets if site.tld/path/key:pageTitle should forward users to the page on the actual site, where "key" is the local identifier. | |
setGlobalId ( $globalId) | |
Sets the global site identifier (ie enwiktionary). | |
setGroup ( $group) | |
Sets the group of the site (ie wikipedia). | |
setInternalId ( $internalId=null) | |
Sets the internal identifier for the site. | |
setLanguageCode ( $languageCode) | |
Sets language code of the sites primary language. | |
setLinkPath ( $fullUrl) | |
Sets the path used to construct links with. | |
setPath ( $pathType, $fullUrl) | |
Sets the path used to construct links with. | |
setSource ( $source) | |
Sets the source of the site data (ie 'local', 'wikidata', 'my-magical-repo'). | |
shouldForward () | |
Gets if site.tld/path/key:pageTitle should forward users to the page on the actual site, where "key" is the local identifier. | |
unserialize ( $serialized) | |
Static Public Member Functions | |
static | newForType ( $siteType) |
Public Attributes | |
const | GROUP_NONE = 'none' |
const | ID_EQUIVALENT = 'equivalent' |
const | ID_INTERWIKI = 'interwiki' |
const | PATH_LINK = 'link' |
const | SOURCE_LOCAL = 'local' |
const | TYPE_MEDIAWIKI = 'mediawiki' |
const | TYPE_UNKNOWN = 'unknown' |
Protected Attributes | |
array | $extraConfig = [] |
array | $extraData = [] |
bool | $forward = false |
string null | $globalId = null |
string | $group = self::GROUP_NONE |
int null | $internalId = null |
string null | $languageCode = null |
array[] | $localIds = [] |
Holds the local ids for this site. | |
string | $source = self::SOURCE_LOCAL |
string | $type = self::TYPE_UNKNOWN |
Site::__construct | ( | $type = self::TYPE_UNKNOWN | ) |
Constructor.
string | $type |
Reimplemented in MediaWikiSite.
Definition at line 131 of file Site.php.
Referenced by unserialize().
Site::addInterwikiId | ( | $identifier | ) |
Adds an interwiki id to the site.
string | $identifier |
Definition at line 521 of file Site.php.
References addLocalId().
Referenced by SiteTest\testAddInterwikiId().
Site::addLocalId | ( | $type, | |
$identifier | |||
) |
Adds a local identifier.
string | $type | |
string | $identifier |
Definition at line 500 of file Site.php.
References $type.
Referenced by addInterwikiId(), and addNavigationId().
Site::addNavigationId | ( | $identifier | ) |
Adds a navigation id to the site.
string | $identifier |
Definition at line 532 of file Site.php.
References addLocalId().
Referenced by SiteTest\testAddNavigationId().
Site::getAllPaths | ( | ) |
Returns the paths as associative array.
The keys are path types, the values are the path urls.
Definition at line 619 of file Site.php.
Referenced by SiteExporter\exportSite(), getPath(), SiteTest\testGetAllPaths(), and SiteTest\testSetAndRemovePath().
Site::getDomain | ( | ) |
Returns the domain of the site, ie en.wikipedia.org Or false if it's not known.
Definition at line 268 of file Site.php.
References $path, and getLinkPath().
Site::getExtraConfig | ( | ) |
Returns the type specific config.
Definition at line 431 of file Site.php.
References $extraConfig.
Site::getExtraData | ( | ) |
Returns the type specific fields.
Definition at line 409 of file Site.php.
References $extraData.
Site::getGlobalId | ( | ) |
Returns the global site identifier (ie enwiktionary).
Definition at line 142 of file Site.php.
References $globalId.
Referenced by SiteExporter\exportSite(), HashSiteStore\saveSite(), SiteTest\testGetGlobalId(), and SiteTest\testSetGlobalId().
Site::getGroup | ( | ) |
Gets the group of the site (ie wikipedia).
Definition at line 181 of file Site.php.
References $group.
Referenced by SiteExporter\exportSite().
Site::getInternalId | ( | ) |
Returns the set internal identifier for the site.
Definition at line 476 of file Site.php.
References $internalId.
Site::getInterwikiIds | ( | ) |
Returns the interwiki link identifiers that can be used for this site.
Definition at line 543 of file Site.php.
References ID_INTERWIKI.
Referenced by SiteTest\testAddInterwikiId(), and SiteTest\testGetInterwikiIds().
Site::getLanguageCode | ( | ) |
Returns language code of the sites primary language.
Or null if it's not known.
Definition at line 454 of file Site.php.
References $languageCode.
Referenced by SiteTest\testGetLanguageCode(), and SiteTest\testSetLanguageCode().
Site::getLinkPath | ( | ) |
Returns the path used to construct links with or false if there is no such path.
Shall be equivalent to getPath( getLinkPathType() ).
Definition at line 336 of file Site.php.
References $type, getLinkPathType(), and getPath().
Referenced by getDomain(), MediaWikiSite\getPageUrl(), getPageUrl(), and getProtocol().
Site::getLinkPathType | ( | ) |
Returns the main path type, that is the type of the path that should generally be used to construct links to the target site.
This default implementation returns Site::PATH_LINK as the default path type. Subclasses can override this to define a different default path type, or return false to disable site links.
Reimplemented in MediaWikiSite.
Definition at line 353 of file Site.php.
References PATH_LINK.
Referenced by getLinkPath(), and setLinkPath().
Site::getLocalIds | ( | ) |
Returns all local ids.
Definition at line 570 of file Site.php.
References $localIds.
Referenced by SitesCacheFileBuilder\buildLocalIdentifiers(), and SiteExporter\exportSite().
Site::getNavigationIds | ( | ) |
Returns the equivalent link identifiers that can be used to make the site show up in interfaces such as the "language links" section.
Definition at line 557 of file Site.php.
References ID_EQUIVALENT.
Referenced by SiteTest\testAddNavigationId(), and SiteTest\testGetNavigationIds().
Site::getPageUrl | ( | $pageName = false | ) |
Returns the full URL for the given page on the site.
Or false if the needed information is not known.
This generated URL is usually based upon the path returned by getLinkPath(), but this is not a requirement.
This implementation returns a URL constructed using the path returned by getLinkPath().
bool | string | $pageName |
Reimplemented in MediaWikiSite.
Definition at line 372 of file Site.php.
References getLinkPath().
Site::getPath | ( | $pathType | ) |
Returns the path of the provided type or false if there is no such path.
string | $pathType |
Definition at line 606 of file Site.php.
References getAllPaths().
Referenced by MediaWikiSite\getFileUrl(), getLinkPath(), MediaWikiSite\getRelativeFilePath(), MediaWikiSite\getRelativePagePath(), SiteTest\testGetPath(), and SiteTest\testSetAndRemovePath().
Site::getProtocol | ( | ) |
Returns the protocol of the site.
MWException |
Definition at line 286 of file Site.php.
References $path, and getLinkPath().
Site::getSource | ( | ) |
Returns the source of the site data (ie 'local', 'wikidata', 'my-magical-repo').
Definition at line 209 of file Site.php.
References $source.
Referenced by SiteExporter\exportSite().
Site::getType | ( | ) |
Returns the type of the site (ie mediawiki).
Definition at line 170 of file Site.php.
References $type.
Referenced by SiteExporter\exportSite(), and SiteTest\testGetType().
|
static |
string | $siteType |
Definition at line 643 of file Site.php.
References $wgSiteTypes, and global.
Referenced by DBSiteStore\loadSites(), SiteImporter\makeSite(), FileBasedSiteLookup\newSiteFromArray(), SiteImporterTest\provideImportFromXML(), SiteExporterTest\provideRoundTrip(), SiteExporterTest\testExportSites(), and SiteImporterTest\testImportFromFile().
Site::normalizePageName | ( | $pageName | ) |
Returns $pageName without changes.
Subclasses may override this to apply some kind of normalization.
string | $pageName |
Reimplemented in MediaWikiSite.
Definition at line 398 of file Site.php.
Referenced by SiteTest\testNormalizePageName().
Site::removePath | ( | $pathType | ) |
Removes the path of the provided type if it's set.
string | $pathType |
Definition at line 630 of file Site.php.
Referenced by SiteTest\testSetAndRemovePath().
Site::serialize | ( | ) |
Definition at line 660 of file Site.php.
References $extraConfig, $extraData, $forward, $globalId, $group, $internalId, $languageCode, $localIds, $source, $type, and serialize().
Referenced by SitesCacheFileBuilder\getSiteAsArray(), and serialize().
Site::setExtraConfig | ( | array | $extraConfig | ) |
Sets the type specific config.
array | $extraConfig |
Definition at line 442 of file Site.php.
References $extraConfig.
Referenced by unserialize().
Site::setExtraData | ( | array | $extraData | ) |
Sets the type specific fields.
array | $extraData |
Definition at line 420 of file Site.php.
References $extraData.
Referenced by unserialize().
Site::setForward | ( | $shouldForward | ) |
Sets if site.tld/path/key:pageTitle should forward users to the page on the actual site, where "key" is the local identifier.
bool | $shouldForward |
MWException |
Definition at line 252 of file Site.php.
Referenced by unserialize().
Site::setGlobalId | ( | $globalId | ) |
Sets the global site identifier (ie enwiktionary).
string | null | $globalId |
MWException |
Definition at line 155 of file Site.php.
References $globalId.
Referenced by SiteTest\testSetGlobalId(), and unserialize().
Site::setGroup | ( | $group | ) |
Sets the group of the site (ie wikipedia).
string | $group |
MWException |
Definition at line 194 of file Site.php.
References $group.
Referenced by unserialize().
Site::setInternalId | ( | $internalId = null | ) |
Sets the internal identifier for the site.
This typically is a primary key in a db table.
int | null | $internalId |
Definition at line 488 of file Site.php.
References $internalId.
Referenced by unserialize().
Site::setLanguageCode | ( | $languageCode | ) |
Sets language code of the sites primary language.
string | $languageCode |
Definition at line 465 of file Site.php.
References $languageCode.
Referenced by SiteTest\testSetLanguageCode(), and unserialize().
Site::setLinkPath | ( | $fullUrl | ) |
Sets the path used to construct links with.
Shall be equivalent to setPath( getLinkPathType(), $fullUrl ).
string | $fullUrl |
MWException |
Definition at line 319 of file Site.php.
References $type, getLinkPathType(), and setPath().
Site::setPath | ( | $pathType, | |
$fullUrl | |||
) |
Sets the path used to construct links with.
Shall be equivalent to setPath( getLinkPathType(), $fullUrl ).
string | $pathType | |
string | $fullUrl |
MWException |
Definition at line 585 of file Site.php.
Referenced by MediaWikiSite\setFilePath(), setLinkPath(), MediaWikiSite\setPagePath(), and SiteTest\testSetAndRemovePath().
Site::setSource | ( | $source | ) |
Sets the source of the site data (ie 'local', 'wikidata', 'my-magical-repo').
string | $source |
MWException |
Definition at line 222 of file Site.php.
References $source, and source.
Referenced by unserialize().
Site::shouldForward | ( | ) |
Gets if site.tld/path/key:pageTitle should forward users to the page on the actual site, where "key" is the local identifier.
Definition at line 238 of file Site.php.
References $forward.
Referenced by SiteExporter\exportSite().
Site::unserialize | ( | $serialized | ) |
string | $serialized |
Definition at line 685 of file Site.php.
References $serialized, __construct(), setExtraConfig(), setExtraData(), setForward(), setGlobalId(), setGroup(), setInternalId(), setLanguageCode(), setSource(), and unserialize().
Referenced by unserialize().
|
protected |
Definition at line 108 of file Site.php.
Referenced by getExtraConfig(), serialize(), and setExtraConfig().
|
protected |
Definition at line 101 of file Site.php.
Referenced by getExtraData(), serialize(), and setExtraData().
|
protected |
|
protected |
Definition at line 56 of file Site.php.
Referenced by getGlobalId(), serialize(), and setGlobalId().
|
protected |
Definition at line 70 of file Site.php.
Referenced by getGroup(), serialize(), and setGroup().
|
protected |
Definition at line 122 of file Site.php.
Referenced by getInternalId(), serialize(), and setInternalId().
|
protected |
Definition at line 84 of file Site.php.
Referenced by getLanguageCode(), serialize(), and setLanguageCode().
|
protected |
Holds the local ids for this site.
local id type => [ ids for this type (strings) ]
Definition at line 94 of file Site.php.
Referenced by getLocalIds(), and serialize().
|
protected |
Definition at line 77 of file Site.php.
Referenced by getSource(), serialize(), and setSource().
|
protected |
Definition at line 63 of file Site.php.
Referenced by MediaWikiSite\__construct(), __construct(), addLocalId(), getLinkPath(), getType(), serialize(), and setLinkPath().
const Site::GROUP_NONE = 'none' |
Definition at line 33 of file Site.php.
Referenced by SiteExporter\exportSite(), and SiteImporter\makeSite().
const Site::ID_EQUIVALENT = 'equivalent' |
Definition at line 36 of file Site.php.
Referenced by getNavigationIds(), SiteImporterTest\provideImportFromXML(), SiteExporterTest\provideRoundTrip(), and SiteImporterTest\testImportFromFile().
const Site::ID_INTERWIKI = 'interwiki' |
Definition at line 35 of file Site.php.
Referenced by getInterwikiIds(), SiteImporterTest\provideImportFromXML(), SiteExporterTest\provideRoundTrip(), SiteExporterTest\testExportSites(), and SiteImporterTest\testImportFromFile().
const Site::PATH_LINK = 'link' |
Definition at line 40 of file Site.php.
Referenced by getLinkPathType(), SiteImporterTest\provideImportFromXML(), SiteExporterTest\provideRoundTrip(), SiteExporterTest\testExportSites(), and SiteImporterTest\testImportFromFile().
const Site::SOURCE_LOCAL = 'local' |
Definition at line 38 of file Site.php.
Referenced by SiteExporter\exportSite(), and SiteImporter\makeSite().
const Site::TYPE_MEDIAWIKI = 'mediawiki' |
Definition at line 31 of file Site.php.
Referenced by SiteImporterTest\provideImportFromXML(), SiteExporterTest\provideRoundTrip(), and SiteImporterTest\testImportFromFile().
const Site::TYPE_UNKNOWN = 'unknown' |
Definition at line 30 of file Site.php.
Referenced by SiteExporter\exportSite(), SiteImporter\makeSite(), FileBasedSiteLookup\newSiteFromArray(), SiteImporterTest\provideImportFromXML(), SiteExporterTest\provideRoundTrip(), SiteExporterTest\testExportSites(), and SiteImporterTest\testImportFromFile().