Currently, site links from the wikibase repository get added to the ParserOutput object when pages on the client wiki are parsed. This makes it impossible to distinguish between locally defined and external links, see T43345: [Task] add info if langlink is stored at repository or local. It also requires re-parsing of the page when external links changed.
This should be improved using the following design:
- Introduce a wrapper class representing a page's language links, per default loading links from the langlinks table. Skins should use that wrapper class to render the list of language links. The langlink table should never be used directly.
- WikibaseClient should hook into that wrapper class, merging in links from the repo's sitelinks table
- To do this, any noexternallanglink usage needs to be stored in the page_props table
- the LangLinks wrapper class needs to expose a generic flags field, that would also be reported by the API. WikibaseClient would use this field to mark links that come from the repo.
- The effective list of links for a page can be cached in memcached.
When a language link changes on the repository, the client should handle that change by
- Invalidating the cached list of langlinks.
- Purge cached version of the page from squids.
The next time the page is requested, the effective list of links will be re-calculated.