80 if ( $this->
hasSite( $site->getGlobalId() ) ) {
84 $this->byGlobalId[$site->getGlobalId()] = $index;
85 $this->byInternalId[$site->getInternalId()] = $index;
87 $ids = $site->getNavigationIds();
88 foreach ( $ids
as $navId ) {
89 $this->byNavigationId[$navId] = $index;
103 if ( $this->offsetExists( $index ) ) {
107 $site = $this->offsetGet( $index );
109 unset( $this->byGlobalId[$site->getGlobalId()] );
110 unset( $this->byInternalId[$site->getInternalId()] );
112 $ids = $site->getNavigationIds();
113 foreach ( $ids
as $navId ) {
114 unset( $this->byNavigationId[$navId] );
118 parent::offsetUnset( $index );
130 return array_keys( $this->byGlobalId );
141 return array_key_exists( $globalSiteId, $this->byGlobalId );
155 return $this->offsetGet( $this->byGlobalId[$globalSiteId] );
167 $this->
offsetUnset( $this->byGlobalId[$globalSiteId] );
178 return $this->byGlobalId === [];
189 return array_key_exists( $id, $this->byInternalId );
203 return $this->offsetGet( $this->byInternalId[$id] );
226 return array_key_exists( $id, $this->byNavigationId );
240 return $this->offsetGet( $this->byNavigationId[$id] );
282 foreach ( $this
as $site ) {
283 if ( $site->getGroup() === $groupName ) {
299 const SERIAL_VERSION_ID =
'2014-03-17';
311 return self::SERIAL_VERSION_ID .
'+Site:' . Site::SERIAL_VERSION_ID;
325 parent::getSerializationData(),
327 'internalIds' => $this->byInternalId,
328 'globalIds' => $this->byGlobalId,
329 'navigationIds' => $this->byNavigationId
346 $this->byInternalId = $serializationData[
'internalIds'];
347 $this->byGlobalId = $serializationData[
'globalIds'];
348 $this->byNavigationId = $serializationData[
'navigationIds'];
350 return $serializationData;
getGlobalIdentifiers()
Returns all the global site identifiers.
getSiteByInternalId($id)
Returns the Site with the provided site id.
unserialize($serialization)
removeSiteByInternalId($id)
Removes the site with the specified site id.
preSetElement($index, $site)
removeSiteByNavigationId($id)
Removes the site with the specified navigational site id.
static getSerialVersionId()
Returns the version ID that identifies the serialization structure used by getSerializationData() and...
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
isEmpty()
Returns if the list contains no sites.
hasInternalId($id)
Returns if the list contains the site with the provided site id.
getSite($globalSiteId)
Returns the Site with the provided global site identifier.
getGroup($groupName)
Returns the sites that are in the provided group.
setSite(Site $site)
Sets a site in the list.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
array $byInternalId
Internal site identifiers pointing to their sites offset value.
array $byGlobalId
Global site identifiers pointing to their sites offset value.
array $byNavigationId
Navigational site identifiers alias inter-language prefixes pointing to their sites offset value...
removeSite($globalSiteId)
Removes the site with the specified global site identifier.
getSiteByNavigationId($id)
Returns the Site with the provided navigational site id.
hasNavigationId($id)
Returns if the list contains the site with the provided navigational site id.
hasSite($globalSiteId)
Returns if the list contains the site with the provided global site identifier.