MediaWiki
master
ParserCacheFilter.php
Go to the documentation of this file.
1
<?php
8
namespace
MediaWiki\Parser
;
9
10
use
MediaWiki\Page\PageRecord
;
11
20
class
ParserCacheFilter
{
21
25
private
array $config;
26
30
public
function
__construct
( array $config ) {
31
$this->config = $config;
32
}
33
34
public
function
shouldCache
(
35
ParserOutput
$output,
36
PageRecord
$page,
37
ParserOptions
$options
38
): bool {
39
$ns = $page->getNamespace();
40
$cpuMin = $this->config[ $ns ][
'minCpuTime'
]
41
?? ( $this->config[
'default'
][
'minCpuTime'
] ?? 0 );
42
43
$cpuTime = $output->
getTimeProfile
(
'cpu'
);
44
45
if
( $cpuTime !==
null
&& $cpuTime < $cpuMin ) {
46
return
false
;
47
}
48
49
return
true
;
50
}
51
52
}
MediaWiki\Parser\ParserCacheFilter
Definition
ParserCacheFilter.php:20
MediaWiki\Parser\ParserCacheFilter\__construct
__construct(array $config)
Definition
ParserCacheFilter.php:30
MediaWiki\Parser\ParserCacheFilter\shouldCache
shouldCache(ParserOutput $output, PageRecord $page, ParserOptions $options)
Definition
ParserCacheFilter.php:34
MediaWiki\Parser\ParserOptions
Set options of the Parser.
Definition
ParserOptions.php:66
MediaWiki\Parser\ParserOutput
ParserOutput is a rendering of a Content object or a message.
Definition
ParserOutput.php:83
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:2379
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:13
includes
Parser
ParserCacheFilter.php
Generated on Mon Dec 15 2025 17:25:19 for MediaWiki by
1.10.0