page = $id; } $this->file = $file; $this->mode = $mode; $this->setEvent('PARSER_CACHE_USE'); parent::__construct( $file . ($syntax ?? '') . $this->getEnvironmentKey(), '.' . $mode ); } /** * Environment-dependent fragment to append to the cache key * * The returned fragment is appended to the cache key in the constructor. Child classes can override * this to include environment-dependent information like DOKU_BASE. * * @return string */ protected function getEnvironmentKey() { return ''; } /** * method contains cache use decision logic * * @return bool see useCache() */ public function makeDefaultCacheDecision() { if (!file_exists($this->file)) { // source doesn't exist return false; } return parent::makeDefaultCacheDecision(); } protected function addDependencies() { // parser cache file dependencies ... $files = [ $this->file, // source DOKU_INC . 'inc/Parsing/Parser.php', // parser DOKU_INC . 'inc/Parsing/Handler.php', // handler ]; $files = array_merge($files, getConfigFiles('main')); // wiki settings $this->depends['files'] = empty($this->depends['files']) ? $files : array_merge($files, $this->depends['files']); parent::addDependencies(); } }