3 namespace dokuwiki\Cache
;
8 class CacheParser
extends Cache
11 public $file = ''; // source file for cache
12 public $mode = ''; // input mode (represents the processing the input file will undergo)
17 * @param string $id page id
18 * @param string $file source file for cache
19 * @param string $mode input mode
21 public function __construct($id, $file, $mode)
31 $this->setEvent('PARSER_CACHE_USE');
32 parent
::__construct($file . $INPUT->server
->str('HTTP_HOST') . $INPUT->server
->str('SERVER_PORT'), '.' . $mode);
36 * method contains cache use decision logic
38 * @return bool see useCache()
40 public function makeDefaultCacheDecision()
43 if (!file_exists($this->file
)) {
46 return parent
::makeDefaultCacheDecision();
49 protected function addDependencies()
52 // parser cache file dependencies ...
54 $this->file
, // ... source
55 DOKU_INC
. 'inc/Parsing/Parser.php', // ... parser
56 DOKU_INC
. 'inc/parser/handler.php', // ... handler
58 $files = array_merge($files, getConfigFiles('main')); // ... wiki settings
60 $this->depends
['files'] = !empty($this->depends
['files']) ?
61 array_merge($files, $this->depends
['files']) :
63 parent
::addDependencies();