Merge "Revision: Simplify loadText() with nested getWithSetCallback"
[lhc/web/wiklou.git] / includes / cache / HTMLFileCache.php
index 29db9c6..1bab0f5 100644 (file)
  */
 class HTMLFileCache extends FileCacheBase {
        /**
-        * Construct an ObjectFileCache from a Title and an action
+        * Construct an HTMLFileCache object from a Title and an action
+        *
+        * @deprecated since 1.24, instantiate this class directly
         * @param Title|string $title Title object or prefixed DB key string
         * @param string $action
         * @throws MWException
         * @return HTMLFileCache
-        *
-        * @deprecated Since 1.24, instantiate this class directly
         */
        public static function newFromTitle( $title, $action ) {
                return new self( $title, $action );
@@ -65,7 +65,7 @@ class HTMLFileCache extends FileCacheBase {
         * @return array
         */
        protected static function cacheablePageActions() {
-               return array( 'view', 'history' );
+               return [ 'view', 'history' ];
        }
 
        /**
@@ -124,15 +124,14 @@ class HTMLFileCache extends FileCacheBase {
                $user = $context->getUser();
                // Check for non-standard user language; this covers uselang,
                // and extensions for auto-detecting user language.
-               $ulang = $context->getLanguage()->getCode();
-               $clang = $wgContLang->getCode();
+               $ulang = $context->getLanguage();
 
                // Check that there are no other sources of variation
-               if ( $user->getId() || $user->getNewtalk() || $ulang != $clang ) {
+               if ( $user->getId() || $user->getNewtalk() || !$ulang->equals( $wgContLang ) ) {
                        return false;
                }
                // Allow extensions to disable caching
-               return Hooks::run( 'HTMLFileCache::useFileCache', array( $context ) );
+               return Hooks::run( 'HTMLFileCache::useFileCache', [ $context ] );
        }
 
        /**