79 if ( $this->
hasSite( $site->getGlobalId() ) ) {
83 $this->byGlobalId[$site->getGlobalId()] = $index;
84 $this->byInternalId[$site->getInternalId()] = $index;
86 $ids = $site->getNavigationIds();
87 foreach ( $ids as $navId ) {
88 $this->byNavigationId[$navId] = $index;
102 if ( $this->offsetExists( $index ) ) {
106 $site = $this->offsetGet( $index );
108 unset( $this->byGlobalId[$site->getGlobalId()] );
109 unset( $this->byInternalId[$site->getInternalId()] );
111 $ids = $site->getNavigationIds();
112 foreach ( $ids as $navId ) {
113 unset( $this->byNavigationId[$navId] );
117 parent::offsetUnset( $index );
129 return array_keys( $this->byGlobalId );
140 return array_key_exists( $globalSiteId, $this->byGlobalId );
154 return $this->offsetGet( $this->byGlobalId[$globalSiteId] );
166 $this->offsetUnset( $this->byGlobalId[$globalSiteId] );
177 return $this->byGlobalId === [];
188 return array_key_exists( $id, $this->byInternalId );
202 return $this->offsetGet( $this->byInternalId[$id] );
214 $this->offsetUnset( $this->byInternalId[$id] );
225 return array_key_exists( $id, $this->byNavigationId );
239 return $this->offsetGet( $this->byNavigationId[$id] );
251 $this->offsetUnset( $this->byNavigationId[$id] );
281 foreach ( $this as $site ) {
282 if ( $site->getGroup() === $groupName ) {
298 private const SERIAL_VERSION_ID =
'2014-03-17';
310 return self::SERIAL_VERSION_ID .
'+Site:' . Site::SERIAL_VERSION_ID;
324 parent::getSerializationData(),
326 'internalIds' => $this->byInternalId,
327 'globalIds' => $this->byGlobalId,
328 'navigationIds' => $this->byNavigationId
343 $this->byInternalId = $serializationData[
'internalIds'];
344 $this->byGlobalId = $serializationData[
'globalIds'];
345 $this->byNavigationId = $serializationData[
'navigationIds'];
if(!defined('MW_SETUP_CALLBACK'))
The persistent session ID (if any) loaded at startup.
Extends ArrayObject and does two things:
Collection of Site objects.
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)
Represents a single site.