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?
|mediawiki/core||master||+18 -14||API: Avoid unstubbing User for language pref when not needed|
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.