Merge "Remove repeated line in RELEASE-NOTES-1.32"
[lhc/web/wiklou.git] / includes / cache / HTMLFileCache.php
index b0a3a1c..3a89066 100644 (file)
@@ -87,7 +87,7 @@ class HTMLFileCache extends FileCacheBase {
        /**
         * Check if pages can be cached for this request/user
         * @param IContextSource $context
-        * @param integer $mode One of the HTMLFileCache::MODE_* constants (since 1.28)
+        * @param int $mode One of the HTMLFileCache::MODE_* constants (since 1.28)
         * @return bool
         */
        public static function useFileCache( IContextSource $context, $mode = self::MODE_NORMAL ) {
@@ -123,7 +123,8 @@ class HTMLFileCache extends FileCacheBase {
                $ulang = $context->getLanguage();
 
                // Check that there are no other sources of variation
-               if ( $user->getId() || $ulang->getCode() !== $config->get( 'LanguageCode' ) ) {
+               if ( $user->getId() ||
+                       !$ulang->equals( MediaWikiServices::getInstance()->getContentLanguage() ) ) {
                        return false;
                }
 
@@ -140,11 +141,10 @@ class HTMLFileCache extends FileCacheBase {
        /**
         * Read from cache to context output
         * @param IContextSource $context
-        * @param integer $mode One of the HTMLFileCache::MODE_* constants
+        * @param int $mode One of the HTMLFileCache::MODE_* constants
         * @return void
         */
        public function loadFromFileCache( IContextSource $context, $mode = self::MODE_NORMAL ) {
-               global $wgContLang;
                $config = MediaWikiServices::getInstance()->getMainConfig();
 
                wfDebug( __METHOD__ . "()\n" );
@@ -157,7 +157,8 @@ class HTMLFileCache extends FileCacheBase {
 
                $context->getOutput()->sendCacheControl();
                header( "Content-Type: {$config->get( 'MimeType' )}; charset=UTF-8" );
-               header( "Content-Language: {$wgContLang->getHtmlCode()}" );
+               header( 'Content-Language: ' .
+                       MediaWikiServices::getInstance()->getContentLanguage()->getHtmlCode() );
                if ( $this->useGzip() ) {
                        if ( wfClientAcceptsGzip() ) {
                                header( 'Content-Encoding: gzip' );