summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
authorchris <chris@jalakai.co.uk>2006-09-25 22:12:22 +0200
committerchris <chris@jalakai.co.uk>2006-09-25 22:12:22 +0200
commit0a69dff7134e858ffe6b95410196a8712522167b (patch)
tree13385326888bdc9c3c9eca79446cf3cd70490999 /inc
parentce6b63d97068e71369bad95e7959d0110717bbfd (diff)
downloadrpg-0a69dff7134e858ffe6b95410196a8712522167b.tar.gz
rpg-0a69dff7134e858ffe6b95410196a8712522167b.tar.bz2
amendments to previous patch updating rss & cache
rss syntax extended to include a refresh parameter <digits><period> period can be d,h,m for days, hours, minutes respectively if not specified will default to 4 hours dokuwiki imposes a minimum of 10 minutes metadata now used "date valid age" (seconds) rather than "date valid end" darcs-hash:20060925201222-9b6ab-c8e6d8e40bb178295bab874fce5147ccff35fbbb.gz
Diffstat (limited to 'inc')
-rw-r--r--inc/cache.php14
-rw-r--r--inc/parser/handler.php7
-rw-r--r--inc/parser/metadata.php8
3 files changed, 18 insertions, 11 deletions
diff --git a/inc/cache.php b/inc/cache.php
index 767ad8a35..a3b16d974 100644
--- a/inc/cache.php
+++ b/inc/cache.php
@@ -223,10 +223,6 @@ class cache_renderer extends cache_parser {
if (isset($this->page)) {
$metadata = p_get_metadata($this->page);
- // page has an expiry time, after which it should be re-rendered (RSS feeds use this)
- $page_expiry = $metadata['date']['valid']['end'];
- if (!empty($page_expiry) && (time() > $page_expiry)) return false;
-
// check currnent link existence is consistent with cache version
// first check the purgefile
// - if the cache is more recent that the purgefile we know no links can have been updated
@@ -255,13 +251,21 @@ class cache_renderer extends cache_parser {
// page implies metadata and possibly some other dependencies
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;
+ return;
}
}
diff --git a/inc/parser/handler.php b/inc/parser/handler.php
index 28e8c4e4b..a8a29783c 100644
--- a/inc/parser/handler.php
+++ b/inc/parser/handler.php
@@ -522,6 +522,13 @@ class Doku_Handler {
$p['date'] = (preg_match('/\b(date)/',$params));
$p['details'] = (preg_match('/\b(desc|detail)/',$params));
+ if (preg_match('/\b(\d+)([dhm])\b/',$params,$match)) {
+ $period = array('d' => 86400, 'h' => 3600, 'm' => 60);
+ $p['refresh'] = max(600,$match[1]*$period[$match[2]]); // n * period in seconds, minimum 10 minutes
+ } else {
+ $p['refresh'] = 14400; // default to 4 hours
+ }
+
$this->_addCall('rss',array($link,$p),$pos);
return TRUE;
}
diff --git a/inc/parser/metadata.php b/inc/parser/metadata.php
index 9704c0475..1c987dbc3 100644
--- a/inc/parser/metadata.php
+++ b/inc/parser/metadata.php
@@ -38,6 +38,7 @@ class Doku_Renderer_metadata extends Doku_Renderer {
$this->meta['description']['tableofcontents'] = array();
$this->meta['relation']['haspart'] = array();
$this->meta['relation']['references'] = array();
+ $this->meta['date']['valid'] = array();
$this->headers = array();
}
@@ -326,13 +327,8 @@ class Doku_Renderer_metadata extends Doku_Renderer {
}
function rss($url,$params) {
- global $conf;
-
$this->meta['relation']['haspart'][$url] = true;
- $this->meta['date']['valid']['end'] =
- empty($this->meta['date']['valid']['end']) ?
- time() + $conf['rss_update'] :
- min($this->meta['date']['valid']['end'], time() + $conf['rss_update']);
+ $this->meta['date']['valid']['age'] = $params['refresh'];
}
function table_open($maxcols = NULL, $numrows = NULL){}