Since we're replacing interwiki with sites the constraints used by links tables are going to be broken. We're probably going to need code changes and perhaps some schema changes to fit them into the new sites system.
iwlinks has a iwl_prefix column and langlinks has a ll_lang column, both of which point to interwiki.iw_prefix.
Since we're going to be breaking things in this area anyways I think we should take this chance to replace iwlinks and langlinks with a sitelinks table. Besides the schema changes this will also make it possible to have things like project links/sister site links (i.e.: different si_types) without needing new tables.
# prefix sitelinks { sl_from INT UNSIGNED, sl_prefix VARBINARY(25), # points to site_identifiers.si_key sl_title VARBINARY(255) } # site sitelinks { sl_from INT UNSIGNED, sl_site ???, # either an INT UNSIGNED pointing to site_id or a VARBINARY pointing to site_global_key, we can discuss that later sl_title VARBINARY(255) }
Both of these options has advantages and disadvantages that we need to sort out.
By using si_prefix the prefix method makes it so that all site links only work when a site has a local prefix. This means that extensions adding interlanguage links to pages from other sources can't add arbitrary interlanguage links to a page.
On the other hand while the site method effectively deals with that issue (and also technically leaves the window open for us to let normal interwiki links be added as language links with something like {{#langlink:Wikipedia:Foo}} or {{#langlink:enwikipedia|Foo}}) by pointing to a site directly when a site_identifiers row for a site is removed all sitelinks pointing to that site have to be refreshed. Even when the prefix used in the page is completely different.
I think we might have to review how the {iw,lang}links system works and is used and figure out how site links will have to work. Especially with cases like modifications to the interwiki table. Thinking about it addition to interwiki/site_identifiers may actually be worse. All of a sudden pagelinks become interwiki links.