Page MenuHomePhabricator

Scaling: Use API requests in PageLoader::fetchConfig
Open, Needs TriagePublic

Description

PageLoader::fetchConfig is responsible for taking a page title (possibly with an interwiki prefix) and fetching the JSON data stored on it. For local titles MediaWiki provides the appropriate abstractions which make this straightforward; for remote titles, we generate an action=raw URL which makes MediaWiki return the contents as proper JSON data.

The problem with this is that MediaWiki does not support generating URLs for a page on another wiki; so we end up with a pile of hacks which are fragile in at least two ways:

  • we assume that the local wiki has the same namespace name as the remote wiki (for the MediaWiki namespace, this fails for about a hundred languages)
  • we assume that the local wiki has the same URL structure as the remote wiki, which is not true for certain developer setups

We should use a proper action API request instead, it's a bit more cumbersome but the URL for that is properly provided for interwikis.

Alternatively, we should improve interwiki URL generation support in MediaWiki core. That's not a crazy idea (at some point it will have to be done anyway, due to requests to the new REST API needing the same information) but of course more work.