74 public function fetch( $prefix ) {
75 if ( $prefix ==
'' ) {
83 return $this->interwikiMap[$prefix];
95 if ( $local ===
null || $interwiki->isLocal() === $local ) {
97 'iw_prefix' => $interwikiId,
98 'iw_url' => $interwiki->getURL(),
99 'iw_api' => $interwiki->getAPI(),
100 'iw_wikiid' => $interwiki->getWikiID(),
101 'iw_local' => $interwiki->isLocal(),
102 'iw_trans' => $interwiki->isTranscludable(),
115 if ( !isset( $this->interwikiMap[$prefix] ) ) {
118 $globalId = $this->interwikiMap[$prefix]->getWikiID();
119 unset( $this->interwikiMap[$prefix] );
122 $site = $this->siteLookup->getSites()->getSite( $globalId );
124 $this->interwikiMap = array_merge( $this->interwikiMap, [ $interwikis[$prefix] ] );
132 $siteList = $this->siteLookup->getSites();
133 foreach ( $siteList as $site ) {
146 if ( $this->interwikiMap ===
null ) {
163 $path = $site->getFileUrl(
'api.php' );
Value object for representing interwiki records.
getSource()
Returns the source of the site data (ie 'local', 'wikidata', 'my-magical-repo').
getGlobalId()
Returns the global site identifier (ie enwiktionary).
getPageUrl( $pageName=false)
Returns the full URL for the given page on the site.
getInterwikiIds()
Returns the interwiki link identifiers that can be used for this site.