Go to the documentation of this file.
98 if ( $this->cacheKey ===
null ) {
100 $source = $this->sitesTable->getName();
102 if ( $this->sitesTable->getTargetWiki() !==
false ) {
106 $this->cacheKey =
wfMemcKey(
"$source/$type" );
126 if ( $this->sites ===
null ) {
130 if ( is_object(
$sites ) ) {
159 $site->setGlobalId( $siteRow->
getField(
'global_key' ) );
161 $site->setInternalId( $siteRow->
getField(
'id' ) );
163 if ( $siteRow->
hasField(
'forward' ) ) {
164 $site->setForward( $siteRow->
getField(
'forward' ) );
167 if ( $siteRow->
hasField(
'group' ) ) {
168 $site->setGroup( $siteRow->
getField(
'group' ) );
171 if ( $siteRow->
hasField(
'language' ) ) {
172 $site->setLanguageCode( $siteRow->
getField(
'language' ) ===
'' ? null : $siteRow->
getField(
'language' ) );
175 if ( $siteRow->
hasField(
'source' ) ) {
176 $site->setSource( $siteRow->
getField(
'source' ) );
179 if ( $siteRow->
hasField(
'data' ) ) {
180 $site->setExtraData( $siteRow->
getField(
'data' ) );
183 if ( $siteRow->
hasField(
'config' ) ) {
184 $site->setExtraConfig( $siteRow->
getField(
'config' ) );
209 'domain' => strrev( $site->
getDomain() ) .
'.',
221 return new ORMRow( $this->sitesTable, $fields );
234 foreach ( $this->sitesTable->select()
as $siteRow ) {
250 foreach ( $ids
as $id ) {
251 if ( $this->sites->hasInternalId( $id->si_site ) ) {
252 $site = $this->sites->getSiteByInternalId( $id->si_site );
253 $site->
addLocalId( $id->si_type, $id->si_key );
254 $this->sites->setSite( $site );
313 $dbw = $this->sitesTable->getWriteDbConnection();
315 $trx = $dbw->trxLevel();
318 $dbw->begin( __METHOD__ );
323 $internalIds =
array();
327 if ( $site->getInternalId() !== null ) {
328 $internalIds[] = $site->getInternalId();
334 foreach ( $site->getLocalIds()
as $idType => $ids ) {
335 foreach ( $ids
as $id ) {
336 $localIds[] =
array( $siteRow->
getId(), $idType, $id );
341 if ( $internalIds !==
array() ) {
344 array(
'si_site' => $internalIds ),
349 foreach ( $localIds
as $localId ) {
353 'si_site' => $localId[0],
354 'si_type' => $localId[1],
355 'si_key' => $localId[2],
362 $dbw->commit( __METHOD__ );
378 public function reset() {
395 public function clear() {
397 $dbw = $this->sitesTable->getWriteDbConnection();
399 $trx = $dbw->trxLevel();
402 $dbw->begin( __METHOD__ );
405 $ok = $dbw->delete(
'sites',
'*', __METHOD__ );
406 $ok = $dbw->delete(
'site_identifiers',
'*', __METHOD__ ) &&
$ok;
409 $dbw->commit( __METHOD__ );
430 'global_key' =>
'str',
475 public static function newSite( $globalId =
false ) {
478 if ( $globalId !==
false ) {
479 $site->setGlobalId( $globalId );
492 if ( $singleton ===
null ) {
493 $singleton =
new static();
504 return $this->
getSites()->getGroup( $group );
static getSerialVersionId()
Returns the version ID that identifies the serialization structure used by getSerializationData() and...
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
hasField( $name)
Gets if a certain field is set.
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.
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
getSite( $globalId, $source='cache')
wfProfileIn( $functionname)
Begin profiling of a function.
getInternalId()
Returns the set internal identifier for the site.
hasSite( $globalSiteId)
Returns if the list contains the site with the provided global site identifier.
getLanguageCode()
Returns language code of the sites primary language.
save( $functionName=null)
Writes the answer to the database, either updating it when it already exists, or inserting it when it...
static newForType( $siteType)
__construct(ORMTable $sitesTable=null)
Constructor.
wfGetMainCache()
Get the main cache object.
wfMemcKey()
Get a cache key.
loadSites()
Fetches the site from the database and loads them into the sites field.
clear()
Clears the list of sites stored in the database.
getGlobalId()
Returns the global site identifier (ie enwiktionary).
getSource()
Returns the source of the site data (ie 'local', 'wikidata', 'my-magical-repo').
static newSite( $globalId=false)
Factory for creating new site objects.
wfProfileOut( $functionname='missing')
Stop profiling of a function.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
getGroup()
Gets the type of the site (ie wikipedia).
addLocalId( $type, $identifier)
Adds a local identifier.
processing should stop and the error should be shown to the user * false
getId()
Returns the objects database id.
getRowFromSite(Site $site)
Get a new ORMRow from a Site object.
getField( $name, $default=null)
Gets the value of a field.
getCacheKey()
Constructs a cache key to use for caching the list of sites.
getExtraConfig()
Returns the type specific config.
siteFromRow(ORMRow $siteRow)
Returns a new Site object constructed from the provided ORMRow.
static newInstance(ORMTable $sitesTable=null)
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
shouldForward()
Gets if site.tld/path/key:pageTitle should forward users to the page on the actual site,...
getSites( $source='cache')
getSite( $globalSiteId)
Returns the Site with the provided global site identifier.
if(PHP_SAPI !='cli') $source
getProtocol()
Returns the protocol of the site.
We use the convention $dbr for read and $dbw for write to help you keep track of whether the database object is a the world will explode Or to be a subsequent write query which succeeded on the master may fail when replicated to the slave due to a unique key collision Replication on the slave will stop and it may take hours to repair the database and get it back online Setting read_only in my cnf on the slave will avoid this but given the dire we prefer to have as many checks as possible We provide a but the wrapper functions like select() and insert() are usually more convenient. They take care of things like table prefixes and escaping for you. If you really need to make your own SQL
reset()
Purges the internal and external cache of the site list, forcing the list of sites to be re-read from...
getExtraData()
Returns the type specific fields.