update ParserCache dependency to reflect new file location
[dokuwiki.git] / inc / Cache / CacheParser.php
blob4d8550dbed17a8a07d6eb506ca2ab5ff02f4e987
1 <?php
3 namespace dokuwiki\Cache;
5 /**
6 * Parser caching
7 */
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)
13 public $page = '';
15 /**
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)
23 global $INPUT;
25 if ($id) {
26 $this->page = $id;
28 $this->file = $file;
29 $this->mode = $mode;
31 $this->setEvent('PARSER_CACHE_USE');
32 parent::__construct($file . $INPUT->server->str('HTTP_HOST') . $INPUT->server->str('SERVER_PORT'), '.' . $mode);
35 /**
36 * method contains cache use decision logic
38 * @return bool see useCache()
40 public function makeDefaultCacheDecision()
43 if (!file_exists($this->file)) {
44 return false;
45 } // source exists?
46 return parent::makeDefaultCacheDecision();
49 protected function addDependencies()
52 // parser cache file dependencies ...
53 $files = array(
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']) :
62 $files;
63 parent::addDependencies();