Page MenuHomePhabricator

Have load.php set $wgLang and the RequestContext language
Closed, DeclinedPublic


There are devious code paths that can still depend on the user preference language no matter how much we try to clean things up, for example Title::getMainPage() when $wgForceUIMsgAsContentMsg contains 'mainpage'.

The only sensible fix is to set the main RequestContext language (and $wgLang) to the ResourceLoader language in load.php.

(T127920: Message class should use appropiate default language based on request context was supposed to be about doing this, but it wound up instead shaving a yak that didn't even need to be shaved.)


Related Gerrit Patches:

Event Timeline

Anomie created this task.Mar 23 2016, 3:03 PM

Change 279122 had a related patch set uploaded (by Anomie):
Have load.php use the RL language, not the user's preference language

Any code relating to RequestContext (including Title::getMainPage() and MediaWiki components) have no business being executed in a load.php request. If that happens, that is an error that may result in cache poisoning due to it being cached and run based on context (not necessarily the global context due to cascading updates and faux requests via OutputPage, StartupModule and other places) and a violation of separation in general for making ResourceLoader more standalone (stretch goal, but design principle nonetheless to not explicitly encourage coupling).

Well, Title::getMainPage() is called from ResourceLoaderStartUpModule, and has been since a long time ago, so you might want to look into that.

Change 279122 abandoned by Anomie:
Have load.php use the RL language, not the user's preference language

Not needed now.

Anomie closed this task as Declined.Apr 18 2016, 8:55 PM

Decided to go a different way.