X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=blobdiff_plain;f=includes%2Fcache%2Flocalisation%2FLocalisationCache.php;h=f20637a42017176a67b9d1aa81c279ce9612e91a;hb=a6643499a4143a94de7f41379e5cb7ae45d22519;hp=d0381cf04d794ec737e6866971d16c225753b446;hpb=62c6f40d73637c777a6bf14eaa4d1512e6663170;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/cache/localisation/LocalisationCache.php b/includes/cache/localisation/LocalisationCache.php index d0381cf04d..db0f380ab2 100644 --- a/includes/cache/localisation/LocalisationCache.php +++ b/includes/cache/localisation/LocalisationCache.php @@ -106,7 +106,7 @@ class LocalisationCache { /** * All item keys */ - static public $allKeys = [ + public static $allKeys = [ 'fallback', 'namespaceNames', 'bookstoreList', 'magicWords', 'messages', 'rtl', 'capitalizeAllNouns', 'digitTransformTable', 'separatorTransformTable', 'minimumGroupingDigits', @@ -122,42 +122,42 @@ class LocalisationCache { * Keys for items which consist of associative arrays, which may be merged * by a fallback sequence. */ - static public $mergeableMapKeys = [ 'messages', 'namespaceNames', + public static $mergeableMapKeys = [ 'messages', 'namespaceNames', 'namespaceAliases', 'dateFormats', 'imageFiles', 'preloadedMessages' ]; /** * Keys for items which are a numbered array. */ - static public $mergeableListKeys = [ 'extraUserToggles' ]; + public static $mergeableListKeys = [ 'extraUserToggles' ]; /** * Keys for items which contain an array of arrays of equivalent aliases * for each subitem. The aliases may be merged by a fallback sequence. */ - static public $mergeableAliasListKeys = [ 'specialPageAliases' ]; + public static $mergeableAliasListKeys = [ 'specialPageAliases' ]; /** * Keys for items which contain an associative array, and may be merged if * the primary value contains the special array key "inherit". That array * key is removed after the first merge. */ - static public $optionalMergeKeys = [ 'bookstoreList' ]; + public static $optionalMergeKeys = [ 'bookstoreList' ]; /** * Keys for items that are formatted like $magicWords */ - static public $magicWordKeys = [ 'magicWords' ]; + public static $magicWordKeys = [ 'magicWords' ]; /** * Keys for items where the subitems are stored in the backend separately. */ - static public $splitKeys = [ 'messages' ]; + public static $splitKeys = [ 'messages' ]; /** * Keys which are loaded automatically by initLanguage() */ - static public $preloadedKeys = [ 'dateFormats', 'namespaceNames' ]; + public static $preloadedKeys = [ 'dateFormats', 'namespaceNames' ]; /** * Associative array of cached plural rules. The key is the language code, @@ -525,15 +525,19 @@ class LocalisationCache { ini_set( 'apc.cache_by_default', $_apcEnabled ); Wikimedia\restoreWarnings(); + $data = []; if ( $_fileType == 'core' || $_fileType == 'extension' ) { - - // Lnguage files aren't required to contain all the possible variables, so suppress warnings - // when variables don't exist in tests - Wikimedia\suppressWarnings(); - $data = compact( self::$allKeys ); - Wikimedia\restoreWarnings(); + foreach ( self::$allKeys as $key ) { + // Not all keys are set in language files, so + // check they exist first + if ( isset( $$key ) ) { + $data[$key] = $$key; + } + } } elseif ( $_fileType == 'aliases' ) { - $data = compact( 'aliases' ); + if ( isset( $aliases ) ) { + $data['aliases'] = $aliases; + } } else { throw new MWException( __METHOD__ . ": Invalid file type: $_fileType" ); } @@ -799,6 +803,7 @@ class LocalisationCache { $messagesDirs = $config->get( 'MessagesDirs' ); return [ 'core' => "$IP/languages/i18n", + 'exif' => "$IP/languages/i18n/exif", 'api' => "$IP/includes/api/i18n", 'oojs-ui' => "$IP/resources/lib/ooui/i18n", ] + $messagesDirs; @@ -1028,7 +1033,7 @@ class LocalisationCache { # HACK: If using a null (i.e. disabled) storage backend, we # can't write to the MessageBlobStore either if ( $purgeBlobs && !$this->store instanceof LCStoreNull ) { - $blobStore = new MessageBlobStore(); + $blobStore = MediaWikiServices::getInstance()->getResourceLoader()->getMessageBlobStore(); $blobStore->clear(); } }