Manual:$wgInterwikiScopes

Details
Interwiki caching settings.

$wgInterwikiCache specifies path to constant database file
 * This cdb database is generated by dumpInterwiki from maintenance and has such key formats:


 * dbname:key - a simple key (e.g. enwiki:meta)
 * _sitename:key - site-scope key (e.g. wiktionary:meta)
 * __global:key - global-scope key (e.g. __global:meta)
 * __sites:dbname - site mapping (e.g. __sites:enwiki)
 * Sites mapping just specifies site name, other keys provide "local url" data layout.

$wgInterwikiScopes specify number of domains to check for messages:
 * 1) - Just wiki(db)-level
 * 2) - wiki and global levels
 * 3) - site levels

$wgInterwikiFallbackSite - if unable to resolve from cache

This appears to use a constant database file (created by one of the maintenance scripts) to provide a list of valid interwiki prefixes and corresponding URLs.