55 if ( $this->sites ===
null ) {
84 foreach ( $data[
'sites'] as $siteArray ) {
96 if ( !is_readable( $this->cacheFile ) ) {
97 throw new MWException(
'SiteList cache file not found.' );
100 $contents = file_get_contents( $this->cacheFile );
101 $data = json_decode( $contents,
true );
103 if ( !is_array( $data ) || !is_array( $data[
'sites'] )
104 || !array_key_exists(
'sites', $data )
106 throw new MWException(
'SiteStore json cache data is invalid.' );
121 $site->setGlobalId( $data[
'globalid'] );
122 $site->setForward( $data[
'forward'] );
123 $site->setGroup( $data[
'group'] );
124 $site->setLanguageCode( $data[
'language'] );
125 $site->setSource( $data[
'source'] );
126 $site->setExtraData( $data[
'data'] );
127 $site->setExtraConfig( $data[
'config'] );
129 foreach ( $data[
'identifiers'] as $identifier ) {
130 $site->addLocalId( $identifier[
'type'], $identifier[
'key'] );