diff options
author | Michael Hamann <michael@content-space.de> | 2010-11-22 21:12:02 +0100 |
---|---|---|
committer | Michael Hamann <michael@content-space.de> | 2010-11-22 21:21:52 +0100 |
commit | 98214867894eba512bf47cba3439ccba3968f49b (patch) | |
tree | 5b6d8c550180d8a6e0f7962a643182e31e85a27c /inc/cache.php | |
parent | 5e1ee188750eca4ed2f13227ede216598c9669c8 (diff) | |
download | rpg-98214867894eba512bf47cba3439ccba3968f49b.tar.gz rpg-98214867894eba512bf47cba3439ccba3968f49b.tar.bz2 |
Render metadata when needed
This changes fundamentally when metadata is rendered. This commit
introduces a new cache file for every page that just contains a
timestamp and is updated whenever the metadata of that page is rendered.
Metadata is rendered when p_get_metadata is called and the last
rendering has been before a page, metadata, configuration or renderer
update or purge is set like in the xhtml renderer cache.
Metadata is no longer automatically rendered when the xhtml renderer
cache isn't used but will still be rendered when needed as
p_get_metadata is called in the cache.
Metadata is also no longer rendered in the indexer script when missing
as that is already done by pageinfo() before anything else is done so
the indexer script won't be called when there is no metadata file.
Diffstat (limited to 'inc/cache.php')
-rw-r--r-- | inc/cache.php | 31 |
1 files changed, 6 insertions, 25 deletions
diff --git a/inc/cache.php b/inc/cache.php index 571b314cd..ff78e37ae 100644 --- a/inc/cache.php +++ b/inc/cache.php @@ -197,18 +197,6 @@ class cache_parser extends cache { } class cache_renderer extends cache_parser { - - function useCache($depends=array()) { - $use = parent::useCache($depends); - - // meta data needs to be kept in step with the cache - if (!$use && isset($this->page)) { - p_set_metadata($this->page,array(),true); - } - - return $use; - } - function _useCache() { global $conf; @@ -251,19 +239,12 @@ class cache_renderer extends cache_parser { if (isset($this->page)) { $metafile = metaFN($this->page,'.meta'); - if (@file_exists($metafile)) { - $files[] = $metafile; // ... the page's own metadata - $files[] = DOKU_INC.'inc/parser/metadata.php'; // ... the metadata renderer - - $valid = p_get_metadata($this->page, 'date valid'); - if (!empty($valid['age'])) { - $this->depends['age'] = isset($this->depends['age']) ? - min($this->depends['age'],$valid['age']) : $valid['age']; - } - - } else { - $this->depends['purge'] = true; // ... purging cache will generate metadata - return; + $files[] = $metafile; // ... the page's own metadata + + $valid = p_get_metadata($this->page, 'date valid'); // for xhtml this will render the metadata if needed + if (!empty($valid['age'])) { + $this->depends['age'] = isset($this->depends['age']) ? + min($this->depends['age'],$valid['age']) : $valid['age']; } } |