From dbb8b00ec768018d961ec433bb09a0d84576ba6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20Dziewo=C5=84ski?= Date: Wed, 25 Aug 2021 11:35:38 +0200 Subject: [PATCH] Remove parser cache splitting ('dtreply' option) Bug: T280599 Change-Id: I08b52874d575619308b5b83a39acfb6353c5b7b5 --- extension.json | 2 -- includes/Hooks/ParserHooks.php | 51 +--------------------------------- 2 files changed, 1 insertion(+), 52 deletions(-) diff --git a/extension.json b/extension.json index 08dac7742..d519ee344 100644 --- a/extension.json +++ b/extension.json @@ -403,10 +403,8 @@ "EchoGetBundleRules": "\\MediaWiki\\Extension\\DiscussionTools\\Hooks\\EchoHooks::onEchoGetBundleRules", "EchoGetEventsForRevision": "\\MediaWiki\\Extension\\DiscussionTools\\Hooks\\EchoHooks::onEchoGetEventsForRevision", "LoadExtensionSchemaUpdates": "installer", - "ArticleParserOptions": "parser", "ParserAfterParse": "parser", "ParserAfterTidy": "parser", - "ParserOptionsRegister": "parser", "BeforeDisplayNoArticleText": "page", "BeforePageDisplay": "page", "GetActionName": "page", diff --git a/includes/Hooks/ParserHooks.php b/includes/Hooks/ParserHooks.php index 26aeca574..812a34f08 100644 --- a/includes/Hooks/ParserHooks.php +++ b/includes/Hooks/ParserHooks.php @@ -9,22 +9,16 @@ namespace MediaWiki\Extension\DiscussionTools\Hooks; -use Article; use ConfigFactory; use MediaWiki\Extension\DiscussionTools\CommentFormatter; use MediaWiki\Hook\ParserAfterParseHook; use MediaWiki\Hook\ParserAfterTidyHook; -use MediaWiki\Hook\ParserOptionsRegisterHook; -use MediaWiki\Page\Hook\ArticleParserOptionsHook; use Parser; -use ParserOptions; use StripState; class ParserHooks implements ParserAfterParseHook, - ParserAfterTidyHook, - ArticleParserOptionsHook, - ParserOptionsRegisterHook + ParserAfterTidyHook { /** @var ConfigFactory */ private $configFactory; @@ -95,47 +89,4 @@ class ParserHooks implements ] ); } } - - /** - * @param Article $article Article about to be parsed - * @param ParserOptions $popts Mutable parser options - * @return bool|void True or no return value to continue or false to abort - */ - public function onArticleParserOptions( Article $article, ParserOptions $popts ) { - $dtConfig = $this->configFactory->makeConfig( 'discussiontools' ); - - if ( - !$dtConfig->get( 'DiscussionToolsUseParserCache' ) || - !HookUtils::isAvailableForTitle( $article->getTitle() ) - ) { - return; - } - - foreach ( CommentFormatter::USE_WITH_FEATURES as $feature ) { - if ( - // If the feature is enabled by default, always apply the DOM transform - $dtConfig->get( 'DiscussionTools_' . $feature ) === 'available' || - // ...or if has been enabled by the user - HookUtils::isFeatureEnabledForUser( $popts->getUserIdentity(), $feature ) - ) { - // For backwards-compatibility until the canonical cache entries - // without DiscussionTools DOM transform expire (T280599) - $popts->setOption( 'dtreply', true ); - return; - } - } - } - - /** - * Register additional parser options - * - * @param array &$defaults - * @param array &$inCacheKey - * @param array &$lazyLoad - * @return bool|void - */ - public function onParserOptionsRegister( &$defaults, &$inCacheKey, &$lazyLoad ) { - $defaults['dtreply'] = null; - $inCacheKey['dtreply'] = true; - } }