Merge "Do not output accept language list if it might get cached"
This commit is contained in:
@@ -344,8 +344,14 @@ class UniversalLanguageSelectorHooks {
|
|||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public static function addVariables( &$vars, OutputPage $out ) {
|
public static function addVariables( &$vars, OutputPage $out ) {
|
||||||
|
global $wgULSAnonCanChangeLanguage;
|
||||||
|
|
||||||
// Place request context dependent stuff here
|
// 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
|
// An optimization to avoid loading all of uls.data just to get the autonym
|
||||||
$langCode = $out->getLanguage()->getCode();
|
$langCode = $out->getLanguage()->getCode();
|
||||||
|
|||||||
Reference in New Issue
Block a user