Merge "Remove Revision::getRevisionText from migrateArchiveText"
[lhc/web/wiklou.git] / includes / cache / localisation / LocalisationCache.php
index ffc7cd0..c6d6b8f 100644 (file)
@@ -519,17 +519,8 @@ class LocalisationCache {
         * @return array
         */
        protected function readPHPFile( $_fileName, $_fileType ) {
-               // Disable APC caching
-               Wikimedia\suppressWarnings();
-               $_apcEnabled = ini_set( 'apc.cache_by_default', '0' );
-               Wikimedia\restoreWarnings();
-
                include $_fileName;
 
-               Wikimedia\suppressWarnings();
-               ini_set( 'apc.cache_by_default', $_apcEnabled );
-               Wikimedia\restoreWarnings();
-
                $data = [];
                if ( $_fileType == 'core' || $_fileType == 'extension' ) {
                        foreach ( self::$allKeys as $key ) {
@@ -731,6 +722,7 @@ class LocalisationCache {
                                if ( in_array( $key, self::$mergeableMapKeys ) ) {
                                        $value = $value + $fallbackValue;
                                } elseif ( in_array( $key, self::$mergeableListKeys ) ) {
+                                       // @phan-suppress-next-line PhanTypeMismatchArgumentInternal
                                        $value = array_unique( array_merge( $fallbackValue, $value ) );
                                } elseif ( in_array( $key, self::$mergeableAliasListKeys ) ) {
                                        $value = array_merge_recursive( $value, $fallbackValue );
@@ -826,7 +818,7 @@ class LocalisationCache {
                if ( !$code ) {
                        throw new MWException( "Invalid language code requested" );
                }
-               $this->recachedLangs[$code] = true;
+               $this->recachedLangs[ $code ] = true;
 
                # Initial values
                $initialData = array_fill_keys( self::$allKeys, null );
@@ -835,16 +827,11 @@ class LocalisationCache {
 
                # Load the primary localisation from the source file
                $data = $this->readSourceFilesAndRegisterDeps( $code, $deps );
-               if ( $data === false ) {
-                       $this->logger->debug( __METHOD__ . ": no localisation file for $code, using fallback to en" );
-                       $coreData['fallback'] = 'en';
-               } else {
-                       $this->logger->debug( __METHOD__ . ": got localisation for $code from source" );
+               $this->logger->debug( __METHOD__ . ": got localisation for $code from source" );
 
-                       # Merge primary localisation
-                       foreach ( $data as $key => $value ) {
-                               $this->mergeItem( $key, $coreData[$key], $value );
-                       }
+               # Merge primary localisation
+               foreach ( $data as $key => $value ) {
+                       $this->mergeItem( $key, $coreData[ $key ], $value );
                }
 
                # Fill in the fallback if it's not there already
@@ -932,16 +919,14 @@ class LocalisationCache {
                                # Load the secondary localisation from the source file to
                                # avoid infinite cycles on cyclic fallbacks
                                $fbData = $this->readSourceFilesAndRegisterDeps( $csCode, $deps );
-                               if ( $fbData !== false ) {
-                                       # Only merge the keys that make sense to merge
-                                       foreach ( self::$allKeys as $key ) {
-                                               if ( !isset( $fbData[$key] ) ) {
-                                                       continue;
-                                               }
-
-                                               if ( is_null( $coreData[$key] ) || $this->isMergeableKey( $key ) ) {
-                                                       $this->mergeItem( $key, $csData[$key], $fbData[$key] );
-                                               }
+                               # Only merge the keys that make sense to merge
+                               foreach ( self::$allKeys as $key ) {
+                                       if ( !isset( $fbData[ $key ] ) ) {
+                                               continue;
+                                       }
+
+                                       if ( is_null( $coreData[ $key ] ) || $this->isMergeableKey( $key ) ) {
+                                               $this->mergeItem( $key, $csData[ $key ], $fbData[ $key ] );
                                        }
                                }
                        }