Page MenuHomePhabricator

Addings Sitelinks should consistently call APIs via the backend/PHP, not Javascript
Open, Needs TriagePublic

Description

The sites database table in Mediawiki lists public URLs for remote Wikis.

When adding SiteLinks in between wikipages and Wikibase items, front-end code (Javascript, running in the same network as the browser) and back-end code (PHP, running in the network of the server) use the same URLs to query wiki APIs of (possibly) remote wikis.

In the docker distribution, it is impossible to make a docker-setup with SiteLinks that can be moved in between production and a local testing setup: there is no way to enter URLs in the sites table that would be accessible from "inside" and "outside" the container and consistently pointing to the whatever the desired version of a private Wikibase is. Effectively that means that a local testing version needs a different sites table than the publicly deployed version, which makes database dumps and in general Wikibase setups non-portable by design.

For instance, even if I set up an alias for the Wikibase container that is the same as the public name for my Wikibase, the back-end will talk to the local version and the front-end to the deployed version. The docker-internal one runs with http, the deployed version runs with https. If I use localhost, a local IP, or internal docker network IP, the public deployment obviously won't work.

It would be easier to manage this if the front-end wouldn't send out requests to (possible) remote wiki APIs, but only query its local back-end, which then could handle talking to remote hosts if required. A "remote" wiki could be set up as localhost from the perspective of the server, and be consistently reachable in both a test setup or a production deployment.