LocalisationCache::recache(): Use array_fill_keys()
authorKevin Israel <pleasestand@live.com>
Thu, 8 Oct 2015 20:29:16 +0000 (16:29 -0400)
committerKevin Israel <pleasestand@live.com>
Thu, 8 Oct 2015 20:29:16 +0000 (16:29 -0400)
LocalisationCache was added in 1.16, so in order to retain PHP 5.1
compatibility, array_fill_keys() was avoided. In 1.17, support for
PHP 5.1 was dropped, so we can use that function now.

Change-Id: I435705639f1a470324a4ba46153351aadc0d40e2

includes/cache/LocalisationCache.php

index f5b2350..fa5e288 100644 (file)
@@ -816,9 +816,7 @@ class LocalisationCache {
                $this->recachedLangs[$code] = true;
 
                # Initial values
-               $initialData = array_combine(
-                       self::$allKeys,
-                       array_fill( 0, count( self::$allKeys ), null ) );
+               $initialData = array_fill_keys( self::$allKeys, null );
                $coreData = $initialData;
                $deps = array();
 
@@ -856,9 +854,7 @@ class LocalisationCache {
                $messageDirs = $this->getMessagesDirs();
 
                # Load non-JSON localisation data for extensions
-               $extensionData = array_combine(
-                       $codeSequence,
-                       array_fill( 0, count( $codeSequence ), $initialData ) );
+               $extensionData = array_fill_keys( $codeSequence, $initialData );
                foreach ( $wgExtensionMessagesFiles as $extension => $fileName ) {
                        if ( isset( $messageDirs[$extension] ) ) {
                                # This extension has JSON message data; skip the PHP shim