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 (cherry picked from commit 2a5cf3fde93263156557bc1efd21c5a74ce67725)
This commit is contained in:
parent
66c2681f7c
commit
b53b5e1d33
2 changed files with 0 additions and 59 deletions
|
|
@ -289,18 +289,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.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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}}' );
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue