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