diff options
author | Aryeh Gregor <ayg@aryeh.name> | 2022-04-26 18:48:03 +0300 |
---|---|---|
committer | Aryeh Gregor <ayg@aryeh.name> | 2022-04-26 19:03:37 +0300 |
commit | 7b791474a53943ecc7d185f529f46a8794383416 (patch) | |
tree | 04bcb69f7eebd41e1ebc71621fae401e4dd74304 /includes/parser/ParserCacheFactory.php | |
parent | d9200a22c2f77817bcddc510b33d329a4718ddd8 (diff) | |
download | mediawikicore-7b791474a53943ecc7d185f529f46a8794383416.tar.gz mediawikicore-7b791474a53943ecc7d185f529f46a8794383416.zip |
Use MainConfigNames instead of string literals, #4
Now largely automated:
VARS=$(grep -o "'[A-Za-z0-9_]*'" includes/MainConfigNames.php | \
tr "\n" '|' | sed "s/|$/\n/;s/'//g")
sed -i -E "s/'($VARS)'/MainConfigNames::\1/g" \
$(grep -ERIl "'($VARS)'" includes/)
Then git add -p with lots of error-prone manual checking. Then
semi-manually add all the necessary "use" lines:
vim $(grep -L 'use MediaWiki\\MainConfigNames;' \
$(git diff --cached --name-only --diff-filter=M HEAD^))
I didn't bother fixing lines that were over 100 characters unless they
were over 120 and triggered phpcs.
Bug: T305805
Change-Id: I74e0ab511abecb276717ad4276a124760a268147
Diffstat (limited to 'includes/parser/ParserCacheFactory.php')
-rw-r--r-- | includes/parser/ParserCacheFactory.php | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/includes/parser/ParserCacheFactory.php b/includes/parser/ParserCacheFactory.php index 8632d8caff7b..b4a3aac0215c 100644 --- a/includes/parser/ParserCacheFactory.php +++ b/includes/parser/ParserCacheFactory.php @@ -26,6 +26,7 @@ use IBufferingStatsdDataFactory; use MediaWiki\Config\ServiceOptions; use MediaWiki\HookContainer\HookContainer; use MediaWiki\Json\JsonCodec; +use MediaWiki\MainConfigNames; use MediaWiki\Page\WikiPageFactory; use ParserCache; use Psr\Log\LoggerInterface; @@ -79,9 +80,9 @@ class ParserCacheFactory { * @internal */ public const CONSTRUCTOR_OPTIONS = [ - 'ParserCacheUseJson', // Temporary feature flag, remove before 1.36 is released. - 'CacheEpoch', - 'OldRevisionParserCacheExpireTime', + MainConfigNames::ParserCacheUseJson, // Temporary feature flag, remove before 1.36 is released. + MainConfigNames::CacheEpoch, + MainConfigNames::OldRevisionParserCacheExpireTime, ]; /** @@ -130,14 +131,14 @@ class ParserCacheFactory { $cache = new ParserCache( $name, $this->parserCacheBackend, - $this->options->get( 'CacheEpoch' ), + $this->options->get( MainConfigNames::CacheEpoch ), $this->hookContainer, $this->jsonCodec, $this->stats, $this->logger, $this->titleFactory, $this->wikiPageFactory, - $this->options->get( 'ParserCacheUseJson' ) + $this->options->get( MainConfigNames::ParserCacheUseJson ) ); $this->parserCaches[$name] = $cache; @@ -156,8 +157,8 @@ class ParserCacheFactory { $cache = new RevisionOutputCache( $name, $this->revisionOutputCacheBackend, - $this->options->get( 'OldRevisionParserCacheExpireTime' ), - $this->options->get( 'CacheEpoch' ), + $this->options->get( MainConfigNames::OldRevisionParserCacheExpireTime ), + $this->options->get( MainConfigNames::CacheEpoch ), $this->jsonCodec, $this->stats, $this->logger |