This is more or less related to T137537: Ensure correct information about Wikimedia sites in the Sites facility on the Wikimedia cluster. , which could be silently fixed with fixing the task, however, I wanted to make sure, that the current implementation (described below) probably works for the specific cases and assumptions in Wikimedia wikis, but does not work for third-party wikis or wikis, which do not meet these assumptions.
Today I worked on getting the ContentTranslation extension up and running and started using the language links functionalities of Wikibase (the Wikibase installation exists for a long time already, but wasn't used for language links, as there was only one wiki with one language until now). During the evaluation and installation of these things, I found out, that Wikibase' LangLinkHandler has a very _specific_ assumption about what the interwiki link of a site might be (until T137537: Ensure correct information about Wikimedia sites in the Sites facility on the Wikimedia cluster. got fixed). It simply removes the "wiki" or "wikitionary" part of the site_global_id and uses the remaining part as the interwiki link:
public function getInterwikiCodeFromSite( Site $site ) { // FIXME: We should use $site->getInterwikiIds, but the interwiki ids in // the sites table are wrong currently, see T137537. $id = $site->getGlobalId(); $id = preg_replace( '/(wiki\w*|wiktionary)$/', '', $id ); $id = strtr( $id, [ '_' => '-' ] ); if ( !$id ) { $id = $site->getLanguageCode(); } return $id; }
This might work very well for WIkimedia and Wikimedia-like wikis, however, it does not work for most of the other wikis. A site_global_key, which ends with wiki, like endroidwiki, will be treated as having an interwiki link of endroid, which is false, as the interwiki link for this wiki is only "en", which is also the prefix saved in the interwiki table of MediaWiki.
While I agree, that task T137537: Ensure correct information about Wikimedia sites in the Sites facility on the Wikimedia cluster. needs to be fixed, I would ask for a workaround/temporary configuration, which allows wikis (like third-party wikis) to use getInterwikiIds of the Site class for the interwiki links, instead of this fuzzy assumption with the site global key.