aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimo Tijhof <krinkle@fastmail.com>2025-03-17 10:00:39 -0700
committerD3r1ck01 <dalangi-ctr@wikimedia.org>2025-04-05 08:43:00 +0000
commit2a5cf3fde93263156557bc1efd21c5a74ce67725 (patch)
treeba33911a0960cfbcca35c49b9a6ba969fc4f97e2
parent2ea61f9aa47399544c308ca95b3941b20d26e74c (diff)
downloadmediawikicore-2a5cf3fde93263156557bc1efd21c5a74ce67725.tar.gz
mediawikicore-2a5cf3fde93263156557bc1efd21c5a74ce67725.zip
REST: Remove unused setUseParserCache() as potential footgun
Added in 2022 with I7d97c9e2d4 (c6a0d433ec) for Ie430acd075 (e82f11c246) which was (after a revert and re-apply) eventually removed after the warmup completed (I852060c8a4, 3df4952385). Bug: T322672 Bug: T387478 Change-Id: I1921b4f985fb27b2227aef4a0eba6751c1c0b8d5
-rw-r--r--includes/Rest/Handler/Helper/HtmlOutputRendererHelper.php12
-rw-r--r--tests/phpunit/integration/includes/Rest/Handler/Helper/HtmlOutputRendererHelperTest.php47
2 files changed, 0 insertions, 59 deletions
diff --git a/includes/Rest/Handler/Helper/HtmlOutputRendererHelper.php b/includes/Rest/Handler/Helper/HtmlOutputRendererHelper.php
index bd0c794e142c..9a5f844d92d1 100644
--- a/includes/Rest/Handler/Helper/HtmlOutputRendererHelper.php
+++ b/includes/Rest/Handler/Helper/HtmlOutputRendererHelper.php
@@ -294,18 +294,6 @@ class HtmlOutputRendererHelper implements HtmlOutputHelper {
}
/**
- * Controls how the parser cache is used.
- *
- * @param bool $read Whether we should look for cached output before parsing
- * @param bool $write Whether we should cache output after parsing
- */
- public function setUseParserCache( bool $read, bool $write ) {
- $this->parserOutputAccessOptions =
- ( $read ? 0 : ParserOutputAccess::OPT_FORCE_PARSE ) |
- ( $write ? 0 : ParserOutputAccess::OPT_NO_UPDATE_CACHE );
- }
-
- /**
* Determine whether stashing should be applied.
*
* @param bool $stash
diff --git a/tests/phpunit/integration/includes/Rest/Handler/Helper/HtmlOutputRendererHelperTest.php b/tests/phpunit/integration/includes/Rest/Handler/Helper/HtmlOutputRendererHelperTest.php
index 31966155af8b..317d6635d3d0 100644
--- a/tests/phpunit/integration/includes/Rest/Handler/Helper/HtmlOutputRendererHelperTest.php
+++ b/tests/phpunit/integration/includes/Rest/Handler/Helper/HtmlOutputRendererHelperTest.php
@@ -984,53 +984,6 @@ class HtmlOutputRendererHelperTest extends MediaWikiIntegrationTestCase {
$helper->getHtml();
}
- public function testDisableParserCacheWrite() {
- $page = $this->getExistingTestPage( __METHOD__ );
-
- // NOTE: The save() method is not supported and will throw!
- // The point of this test case is asserting that save() isn't called.
- $parserCache = $this->createNoOpMock( ParserCache::class, [ 'get', 'getDirty', 'makeParserOutputKey' ] );
- $parserCache->method( 'get' )->willReturn( false );
- $parserCache->method( 'getDirty' )->willReturn( false );
- $parserCache->expects( $this->atLeastOnce() )->method( 'makeParserOutputKey' );
-
- $this->resetServicesWithMockedParsoid();
- $access = $this->newRealParserOutputAccess( [
- 'parserCache' => $parserCache,
- 'revisionCache' => $this->createNoOpMock( RevisionOutputCache::class ),
- ] );
-
- $helper = $this->newHelper( $access, $page, self::PARAM_DEFAULTS, $this->newAuthority() );
-
- // Set read = true, write = false
- $helper->setUseParserCache( true, false );
- $helper->getHtml();
- }
-
- public function testDisableParserCacheRead() {
- $page = $this->getExistingTestPage( __METHOD__ );
-
- // NOTE: The get() method is not supported and will throw!
- // The point of this test case is asserting that get() isn't called.
- // We also check that save() is still called.
- // (Also ::getDirty() shouldn't be used on this path and will throw!)
- $parserCache = $this->createNoOpMock( ParserCache::class, [ 'save', 'makeParserOutputKey' ] );
- $parserCache->expects( $this->once() )->method( 'save' );
- $parserCache->expects( $this->atLeastOnce() )->method( 'makeParserOutputKey' );
-
- $this->resetServicesWithMockedParsoid();
- $access = $this->newRealParserOutputAccess( [
- 'parserCache' => $parserCache,
- 'revisionCache' => $this->createNoOpMock( RevisionOutputCache::class ),
- ] );
-
- $helper = $this->newHelper( $access, $page, self::PARAM_DEFAULTS, $this->newAuthority() );
-
- // Set read = false, write = true
- $helper->setUseParserCache( false, true );
- $helper->getHtml();
- }
-
public function testGetParserOutputWithLanguageOverride() {
[ $page, [ 'latest' => $revision ] ] = $this->getExistingPageWithRevisions( __METHOD__, '{{PAGELANGUAGE}}' );