diff --git a/conf/dokuwiki.php b/conf/dokuwiki.php index 411d2be7d57c2a27a1ef8893a0c3e7118312507f..7d70838da2c6020d77ea5ceaa7c82d1304e20e6e 100644 --- a/conf/dokuwiki.php +++ b/conf/dokuwiki.php @@ -94,6 +94,7 @@ $conf['rss_linkto'] = 'diff'; //what page RSS entries link to: // 'page' - the revised page itself // 'rev' - page showing all revisions // 'current' - most recent revision of page +$conf['rss_update'] = 5*60; //Update the RSS feed every n minutes (defaults to 5 minutes) //Set target to use when creating links - leave empty for same window $conf['target']['wiki'] = ''; diff --git a/feed.php b/feed.php index 9636e65558a12b5bfbc45309302c2156dd13c4bb..d4bcba5fc6eacab0ee3f19db1898a02d1270cfd8 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; // ---------------------------------------------------------------- //