Do not output accept language list if it might get cached

Bug: T137522
Change-Id: Ib603f836f59f7078ac5dbb7bbbb3b84ca358cb43
This commit is contained in:
Niklas Laxström
2016-06-10 10:04:02 +02:00
parent 3316ae94fe
commit d21e271c92

View File

@@ -344,8 +344,14 @@ class UniversalLanguageSelectorHooks {
* @return bool
*/
public static function addVariables( &$vars, OutputPage $out ) {
global $wgULSAnonCanChangeLanguage;
// Place request context dependent stuff here
$vars['wgULSAcceptLanguageList'] = array_keys( $out->getRequest()->getAcceptLang() );
// Do not output accept languages if there is risk it will get cached accross requests
if ( $wgULSAnonCanChangeLanguage || $out->getUser()->isLoggedIn() ) {
$vars['wgULSAcceptLanguageList'] = array_keys( $out->getRequest()->getAcceptLang() );
}
// An optimization to avoid loading all of uls.data just to get the autonym
$langCode = $out->getLanguage()->getCode();