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] );
215 $this->offsetUnset( $this->byInternalId[$id] );
226 return array_key_exists( $id, $this->byNavigationId );
240 return $this->offsetGet( $this->byNavigationId[$id] );
252 $this->offsetUnset( $this->byNavigationId[$id] );
282 foreach ( $this as $site ) {
283 if ( $site->getGroup() === $groupName ) {
299 private 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
344 $this->byInternalId = $serializationData[
'internalIds'];
345 $this->byGlobalId = $serializationData[
'globalIds'];
346 $this->byNavigationId = $serializationData[
'navigationIds'];
if(ini_get('mbstring.func_overload')) if(!defined('MW_ENTRY_POINT'))
Pre-config setup: Before loading LocalSettings.php.
removeSite( $globalSiteId)
Removes the site with the specified global site identifier.
isEmpty()
Returns if the list contains no sites.
removeSiteByInternalId( $id)
Removes the site with the specified site id.
hasInternalId( $id)
Returns if the list contains the site with the provided site id.
hasNavigationId( $id)
Returns if the list contains the site with the provided navigational site id.
getGlobalIdentifiers()
Returns all the global site identifiers.
setSite(Site $site)
Sets a site in the list.
array $byInternalId
Internal site identifiers pointing to their sites offset value.
array $byGlobalId
Global site identifiers pointing to their sites offset value.
getSiteByNavigationId( $id)
Returns the Site with the provided navigational site id.
getGroup( $groupName)
Returns the sites that are in the provided group.
removeSiteByNavigationId( $id)
Removes the site with the specified navigational site id.
__unserialize( $serializationData)
static getSerialVersionId()
Returns the version ID that identifies the serialization structure used by getSerializationData() and...
array $byNavigationId
Navigational site identifiers alias inter-language prefixes pointing to their sites offset value.
hasSite( $globalSiteId)
Returns if the list contains the site with the provided global site identifier.
getSite( $globalSiteId)
Returns the Site with the provided global site identifier.
getSiteByInternalId( $id)
Returns the Site with the provided site id.
preSetElement( $index, $site)