From: James D. Forrester Date: Tue, 8 Oct 2019 18:25:30 +0000 (-0700) Subject: Services: Convert LocalisationCache's static to a const now HHVM is gone X-Git-Tag: 1.34.0-rc.0~20^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/%22%24mplink/%40%20%27info_classement_2%27%20=%3E%20%27%C3%82%C2%A0out%20of%20%40liste%40%27%2C%20%27info_code_acces%27%20=%3E%20%27Do%20not%20forget%20your%20own%20access%20codes%21%27%2C%20%27info_compatibilite_html%27%20=%3E%20%27HTML%20norm%20to%20apply%27%2C-%27info_compresseur_gzip%27%20=%3E%20%27It%20is%20advisable%20to%20check%20first%20whether%20your%20hosting%20provider%20already%20systematically%20compresses%20PHP%20scripts.%20To%20do%20this%20you%20can%20use%20a%20service%20such%20as%20%40testgzip%40%27%2C-%27info_compresseur_texte%27%20=%3E%20%27If%20your%20server%20does%20not%20compress%20HTML%20pages%20before%20sending%20them%2C%20you%20can%20attempt%20to%20force%20compression%20in%20order%20to%20reduce%20the%20size%20of%20the%20pages%20transmitted.%3Cb%3EWarning%3C/b%3E:%20this%20can%20have%20a%20noticeable%20adverse%20effect%20on%20the%20performance%20of%20some%20servers%2C%20%27%2C%20%27info_config_suivi%27%20=%3E%20%27If%20this%20address%20corresponds%20to%20a%20mailing%20list%2C%20you%20can%20indicate%20the%20subscription%20address%20for%20this%20list.%20This%20may%20be%20a%20URL%20%28e.g.%20a%20webpage%20enabling%20subscription%20online%29%2C%20or%20an%20email%20address%20with%20a%20specific%20subject%20%28for%20instance:%20%3Ctt%3E%40adresse_suivi%40?a=commitdiff_plain;h=101493a70783b15656daa0686d404ac1a7a6976b;p=lhc%2Fweb%2Fwiklou.git Services: Convert LocalisationCache's static to a const now HHVM is gone Change-Id: If5c015debed7efc034613b976bc5292ac30036d7 (cherry picked from commit ebac0247cf38b45a253042be16998c7fffbffcbc) --- diff --git a/includes/ServiceWiring.php b/includes/ServiceWiring.php index 003b640ad8..4f3f5d9241 100644 --- a/includes/ServiceWiring.php +++ b/includes/ServiceWiring.php @@ -298,7 +298,7 @@ return [ return new $conf['class']( new ServiceOptions( - LocalisationCache::$constructorOptions, + LocalisationCache::CONSTRUCTOR_OPTIONS, // Two of the options are stored in $wgLocalisationCacheConf $conf, // In case someone set that config variable and didn't reset all keys, set defaults. diff --git a/includes/cache/localisation/LocalisationCache.php b/includes/cache/localisation/LocalisationCache.php index 0f186b67c6..a9e69697d6 100644 --- a/includes/cache/localisation/LocalisationCache.php +++ b/includes/cache/localisation/LocalisationCache.php @@ -221,12 +221,10 @@ class LocalisationCache { } /** - * @todo Make this a const when HHVM support is dropped (T192166) - * * @var array * @since 1.34 */ - public static $constructorOptions = [ + public const CONSTRUCTOR_OPTIONS = [ // True to treat all files as expired until they are regenerated by this object. 'forceRecache', 'manualRecache', @@ -254,7 +252,7 @@ class LocalisationCache { LoggerInterface $logger, array $clearStoreCallbacks = [] ) { - $options->assertRequiredOptions( self::$constructorOptions ); + $options->assertRequiredOptions( self::CONSTRUCTOR_OPTIONS ); $this->options = $options; $this->store = $store; diff --git a/maintenance/rebuildLocalisationCache.php b/maintenance/rebuildLocalisationCache.php index 1f4ac8517a..07c55698df 100644 --- a/maintenance/rebuildLocalisationCache.php +++ b/maintenance/rebuildLocalisationCache.php @@ -88,7 +88,7 @@ class RebuildLocalisationCache extends Maintenance { // XXX Copy-pasted from ServiceWiring.php. Do we need a factory for this one caller? $lc = new LocalisationCacheBulkLoad( new ServiceOptions( - LocalisationCache::$constructorOptions, + LocalisationCache::CONSTRUCTOR_OPTIONS, $conf, MediaWikiServices::getInstance()->getMainConfig() ), diff --git a/tests/phpunit/includes/cache/LocalisationCacheTest.php b/tests/phpunit/includes/cache/LocalisationCacheTest.php index ecdfae4614..af1ff86515 100644 --- a/tests/phpunit/includes/cache/LocalisationCacheTest.php +++ b/tests/phpunit/includes/cache/LocalisationCacheTest.php @@ -26,7 +26,7 @@ class LocalisationCacheTest extends MediaWikiTestCase { $lc = $this->getMockBuilder( LocalisationCache::class ) ->setConstructorArgs( [ - new ServiceOptions( LocalisationCache::$constructorOptions, [ + new ServiceOptions( LocalisationCache::CONSTRUCTOR_OPTIONS, [ 'forceRecache' => false, 'manualRecache' => false, 'ExtensionMessagesFiles' => [],