summaryrefslogtreecommitdiff
path: root/feed.php
diff options
context:
space:
mode:
authorBen Coburn <btcoburn@silicodon.net>2006-03-24 14:33:15 +0100
committerBen Coburn <btcoburn@silicodon.net>2006-03-24 14:33:15 +0100
commitfbf8293902dc7312114b3281713d03bf977793c9 (patch)
tree4900d8318e9390fb7ef7ed0aa11ea8b2025eeaec /feed.php
parenta609a9cc3002627e7527161f5bd8883b3bd0633d (diff)
downloadrpg-fbf8293902dc7312114b3281713d03bf977793c9.tar.gz
rpg-fbf8293902dc7312114b3281713d03bf977793c9.tar.bz2
RSS update time and 304 Not Modified
- Gives the wiki administrator control over how often the RSS feed is regenerated. - The RSS feed now handles conditional requests and returns HTTP '304 Not Modified' responses when possible. darcs-hash:20060324133315-05dcb-3b814e28523f2a0717222a4940d6fbbb28576cf5.gz
Diffstat (limited to 'feed.php')
-rw-r--r--feed.php13
1 files changed, 9 insertions, 4 deletions
diff --git a/feed.php b/feed.php
index 9636e6555..d4bcba5fc 100644
--- a/feed.php
+++ b/feed.php
@@ -12,6 +12,7 @@
require_once(DOKU_INC.'inc/parserutils.php');
require_once(DOKU_INC.'inc/feedcreator.class.php');
require_once(DOKU_INC.'inc/auth.php');
+ require_once(DOKU_INC.'inc/pageutils.php');
//close session
session_write_close();
@@ -46,12 +47,17 @@
$cache = getCacheName($num.$type.$mode.$ns.$ltype.$_SERVER['REMOTE_USER'],'.feed');
// check cacheage and deliver if nothing has changed since last
- // time (with 5 minutes settletime)
+ // time or the update interval has not passed, also handles conditional requests
+ header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
+ header('Pragma: public');
+ header('Content-Type: application/xml; charset=utf-8');
$cmod = @filemtime($cache); // 0 if not exists
- if($cmod && ($cmod+(5*60) >= @filemtime($conf['changelog']))){
- header('Content-Type: application/xml; charset=utf-8');
+ if($cmod && (($cmod+$conf['rss_update']>time()) || ($cmod>@filemtime($conf['changelog'])))){
+ http_conditionalRequest($cmod);
print io_readFile($cache);
exit;
+ } else {
+ http_conditionalRequest(time());
}
// create new feed
@@ -79,7 +85,6 @@
io_saveFile($cache,$feed);
// finally deliver
- header('Content-Type: application/xml; charset=utf-8');
print $feed;
// ---------------------------------------------------------------- //