Do not output accept language list if it might get cached
Bug: T137522 Change-Id: Ib603f836f59f7078ac5dbb7bbbb3b84ca358cb43
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user