Page MenuHomePhabricator

Wikibase\SitesModule depends on request data
Closed, ResolvedPublic

Description

The load.php endpoint is not supposed to depend on session data, however Wikibase\SitesModule depends on the language of $wgUser.

SessionManager.php line 190 calls MediaWiki\Session\SessionManager->getSessionFromInfo()
WebRequest.php line 664 calls MediaWiki\Session\SessionManager->getSessionForRequest()
User.php line 1174 calls WebRequest->getSession()
User.php line 384 calls User->loadFromSession()
User.php line 5087 calls User->load()
User.php line 2705 calls User->loadOptions()
RequestContext.php line 368 calls User->getOption()
StubObject.php line 204 calls RequestContext->getLanguage()
StubObject.php line 160 calls StubUserLang->_newObject()
StubObject.php line 104 calls StubObject->_unstub()
StubObject.php line 179 calls StubObject->_call()
MessageCache.php line 822 calls StubUserLang->__call()
MessageCache.php line 767 calls MessageCache->getMessageFromFallbackChain()
Message.php line 1148 calls MessageCache->get()
Message.php line 910 calls Message->fetchMessage()
SitesModuleWorker.php line 141 calls Message->exists()
SitesModuleWorker.php line 119 calls Wikibase\Lib\SitesModuleWorker->getSiteDetails()
SitesModule.php line 45 calls Wikibase\Lib\SitesModuleWorker->getScript()
ResourceLoaderModule.php line 576 calls Wikibase\SitesModule->getScript()
ResourceLoaderModule.php line 544 calls ResourceLoaderModule->buildContent()
ResourceLoader.php line 976 calls ResourceLoaderModule->getModuleContent()
ResourceLoader.php line 705 calls ResourceLoader->makeModuleResponse()
load.php line 45 calls ResourceLoader->respond()
load.php line 3 calls include()

If the special site names aren't supposed to depend on the user's language, you could just use ->inContentLanguage() on the Message object. Otherwise, you might use the 'MakeGlobalVariablesScript' hook instead or use the language from the ResourceLoaderContext.

Details

Related Gerrit Patches:
mediawiki/extensions/Wikibase : wmf/1.27.0-wmf.14Use ResourceLoaderContext language in SitesModuleWorker
mediawiki/extensions/Wikibase : masterUse ResourceLoaderContext language in SitesModuleWorker

Event Timeline

Anomie created this task.Feb 23 2016, 8:54 PM
Anomie updated the task description. (Show Details)Feb 23 2016, 9:04 PM
aude added a subscriber: aude.Feb 23 2016, 9:54 PM

I think user language is somewhat important in this case.

It allows, for example if my language is arabic, to enter a commons site like by typing كومنز

Then you'll probably want to pass in the language from the ResourceLoaderContext passed into SitesModule::getScript().

Change 272952 had a related patch set uploaded (by Aude):
Use ResourceLoaderContext language in SitesModuleWorker

https://gerrit.wikimedia.org/r/272952

Change 272952 merged by jenkins-bot:
Use ResourceLoaderContext language in SitesModuleWorker

https://gerrit.wikimedia.org/r/272952

Anomie closed this task as Resolved.Feb 25 2016, 4:49 PM

Change 273498 had a related patch set uploaded (by JanZerebecki):
Use ResourceLoaderContext language in SitesModuleWorker

https://gerrit.wikimedia.org/r/273498

Change 273498 abandoned by JanZerebecki:
Use ResourceLoaderContext language in SitesModuleWorker

https://gerrit.wikimedia.org/r/273498