Update suppressWarning()/restoreWarning() calls
[lhc/web/wiklou.git] / includes / cache / localisation / LocalisationCache.php
index 90b3de1..dd9e8e1 100644 (file)
@@ -20,8 +20,6 @@
  * @file
  */
 
-use Cdb\Reader as CdbReader;
-use Cdb\Writer as CdbWriter;
 use CLDRPluralRuleParser\Evaluator;
 use CLDRPluralRuleParser\Error as CLDRPluralRuleError;
 use MediaWiki\MediaWikiServices;
@@ -111,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',
@@ -183,7 +182,6 @@ class LocalisationCache {
        private $mergeableKeys = null;
 
        /**
-        * Constructor.
         * For constructor parameters, see the documentation in DefaultSettings.php
         * for $wgLocalisationCacheConf.
         *
@@ -201,34 +199,32 @@ 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::class;
                                        } else {
-                                               $cacheDir = $wgCacheDirectory ?: wfTempDir();
-                                               if ( $cacheDir ) {
-                                                       $storeConf['directory'] = $cacheDir;
-                                                       $storeClass = 'LCStoreCDB';
-                                               } else {
-                                                       $storeClass = 'LCStoreDB';
-                                               }
+                                               $storeClass = LCStoreDB::class;
                                        }
                                        break;
                                default:
                                        throw new MWException(
-                                               'Please set $wgLocalisationCacheConf[\'store\'] to something sensible.' );
+                                               'Please set $wgLocalisationCacheConf[\'store\'] to something sensible.'
+                                       );
                        }
                }
 
-               wfDebugLog( 'caches', get_class( $this ) . ": using store $storeClass" );
+               wfDebugLog( 'caches', static::class . ": using store $storeClass" );
                if ( !empty( $conf['storeDirectory'] ) ) {
                        $storeConf['directory'] = $conf['storeDirectory'];
                }
@@ -521,15 +517,15 @@ 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();
 
                if ( $_fileType == 'core' || $_fileType == 'extension' ) {
                        $data = compact( self::$allKeys );
@@ -690,7 +686,7 @@ class LocalisationCache {
         * exists, the data array is returned, otherwise false is returned.
         *
         * @param string $code
-        * @param array $deps
+        * @param array &$deps
         * @return array
         */
        protected function readSourceFilesAndRegisterDeps( $code, &$deps ) {
@@ -722,7 +718,7 @@ class LocalisationCache {
         * Merge two localisation values, a primary and a fallback, overwriting the
         * primary value in place.
         * @param string $key
-        * @param mixed $value
+        * @param mixed &$value
         * @param mixed $fallbackValue
         */
        protected function mergeItem( $key, &$value, $fallbackValue ) {
@@ -752,7 +748,7 @@ class LocalisationCache {
        }
 
        /**
-        * @param mixed $value
+        * @param mixed &$value
         * @param mixed $fallbackValue
         */
        protected function mergeMagicWords( &$value, $fallbackValue ) {
@@ -778,7 +774,7 @@ class LocalisationCache {
         * otherwise.
         * @param array $codeSequence
         * @param string $key
-        * @param mixed $value
+        * @param mixed &$value
         * @param mixed $fallbackValue
         * @return bool
         */