X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fcache%2Flocalisation%2FLocalisationCache.php;h=e7b955489d457fe2a22616548e9fc55413badf53;hp=a0ce95e47a8dd5daeb610dd7c0078fad16ec8f61;hb=18fcb2bf29eca1ad0c15aafaa3b4bf4b1c8a3355;hpb=732b5e2745ca8f6153e19cc10c3c9acb1b2a6331 diff --git a/includes/cache/localisation/LocalisationCache.php b/includes/cache/localisation/LocalisationCache.php index a0ce95e47a..e7b955489d 100644 --- a/includes/cache/localisation/LocalisationCache.php +++ b/includes/cache/localisation/LocalisationCache.php @@ -109,7 +109,8 @@ class LocalisationCache { static public $allKeys = [ 'fallback', 'namespaceNames', 'bookstoreList', 'magicWords', 'messages', 'rtl', 'capitalizeAllNouns', 'digitTransformTable', - 'separatorTransformTable', 'fallback8bitEncoding', 'linkPrefixExtension', + 'separatorTransformTable', 'minimumGroupingDigits', + 'fallback8bitEncoding', 'linkPrefixExtension', 'linkTrail', 'linkPrefixCharset', 'namespaceAliases', 'dateFormats', 'datePreferences', 'datePreferenceMigrationMap', 'defaultDateFormat', 'extraUserToggles', 'specialPageAliases', @@ -198,22 +199,22 @@ class LocalisationCache { switch ( $conf['store'] ) { case 'files': case 'file': - $storeClass = 'LCStoreCDB'; + $storeClass = LCStoreCDB::class; break; case 'db': - $storeClass = 'LCStoreDB'; + $storeClass = LCStoreDB::class; break; case 'array': - $storeClass = 'LCStoreStaticArray'; + $storeClass = LCStoreStaticArray::class; break; case 'detect': if ( !empty( $conf['storeDirectory'] ) ) { - $storeClass = 'LCStoreCDB'; + $storeClass = LCStoreCDB::class; } elseif ( $wgCacheDirectory ) { $storeConf['directory'] = $wgCacheDirectory; - $storeClass = 'LCStoreCDB'; + $storeClass = LCStoreCDB::class; } else { - $storeClass = 'LCStoreDB'; + $storeClass = LCStoreDB::class; } break; default: @@ -516,20 +517,30 @@ class LocalisationCache { */ protected function readPHPFile( $_fileName, $_fileType ) { // Disable APC caching - MediaWiki\suppressWarnings(); + Wikimedia\suppressWarnings(); $_apcEnabled = ini_set( 'apc.cache_by_default', '0' ); - MediaWiki\restoreWarnings(); + Wikimedia\restoreWarnings(); include $_fileName; - MediaWiki\suppressWarnings(); + Wikimedia\suppressWarnings(); ini_set( 'apc.cache_by_default', $_apcEnabled ); - MediaWiki\restoreWarnings(); + Wikimedia\restoreWarnings(); + $data = []; if ( $_fileType == 'core' || $_fileType == 'extension' ) { - $data = compact( self::$allKeys ); + 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 ) ) { + /** @suppress PhanUndeclaredVariable */ + $data['aliases'] = $aliases; + } } else { throw new MWException( __METHOD__ . ": Invalid file type: $_fileType" ); }