MediaWiki
master
ParserCacheFilter.php
Go to the documentation of this file.
1
<?php
22
namespace
MediaWiki\Parser
;
23
24
use
MediaWiki\Page\PageRecord
;
25
34
class
ParserCacheFilter
{
35
39
private
array $config;
40
44
public
function
__construct
( array $config ) {
45
$this->config = $config;
46
}
47
48
public
function
shouldCache
(
49
ParserOutput
$output,
50
PageRecord
$page,
51
ParserOptions
$options
52
): bool {
53
$ns = $page->getNamespace();
54
$cpuMin = $this->config[ $ns ][
'minCpuTime'
]
55
?? ( $this->config[
'default'
][
'minCpuTime'
] ?? 0 );
56
57
$cpuTime = $output->
getTimeProfile
(
'cpu'
);
58
59
if
( $cpuTime !==
null
&& $cpuTime < $cpuMin ) {
60
return
false
;
61
}
62
63
return
true
;
64
}
65
66
}
MediaWiki\Parser\ParserCacheFilter
Definition
ParserCacheFilter.php:34
MediaWiki\Parser\ParserCacheFilter\__construct
__construct(array $config)
Definition
ParserCacheFilter.php:44
MediaWiki\Parser\ParserCacheFilter\shouldCache
shouldCache(ParserOutput $output, PageRecord $page, ParserOptions $options)
Definition
ParserCacheFilter.php:48
MediaWiki\Parser\ParserOptions
Set options of the Parser.
Definition
ParserOptions.php:63
MediaWiki\Parser\ParserOutput
ParserOutput is a rendering of a Content object or a message.
Definition
ParserOutput.php:93
MediaWiki\Parser\ParserOutput\getTimeProfile
getTimeProfile(string $clock)
Returns the time that elapsed between the most recent call to resetParseStartTime() and the first cal...
Definition
ParserOutput.php:2282
MediaWiki\Page\PageRecord
Data record representing a page that is (or used to be, or could be) an editable page on a wiki.
Definition
PageRecord.php:26
MediaWiki\Parser
Definition
BlockLevelPass.php:27
includes
parser
ParserCacheFilter.php
Generated on Sun Mar 23 2025 20:25:02 for MediaWiki by
1.10.0