ApiMain by default always sets context language to that of user, which involves $user->getOption( 'language' ) which i turn calls User::loadOptions() which calls the UserGetDefaultOptions hook which is handled by many extensions, including the noticeably slow processing by Gadgets. Can the API lazy load it or maybe User can perform a minimal initialization for language only?
Description
Details
Subject | Repo | Branch | Lines +/- | |
---|---|---|---|---|
API: Avoid unstubbing User for language pref when not needed | mediawiki/core | master | +18 -14 |
Related Objects
Event Timeline
I had originally wanted uselang=user to not be the default, but lots of people complained.
For User to perform a minimal initialization for language only, we'd basically have to make it so that the UserGetDefaultOptions and UserLoadOptions hooks couldn't affect the language preference. That seems liable to be problematic in the future.
Real lazy loading would also be a bit annoying (we'd either have to implement an ApiDerivativeContext just to override the one method, or find anyone who calls ->getContext() on an API object and fix them), so let's see if they'll let us get away with moving uselang=user into RequestContext itself and have the API just punt on it.
Change 182832 had a related patch set uploaded (by Anomie):
API: Avoid unstubbing User for language pref when not needed
Change 182832 merged by jenkins-bot:
API: Avoid unstubbing User for language pref when not needed