The attached patch: * Defines RECENTS_ONLY_CREATES. * Modfies changelog.php:_handleRecent() to return only "create" changelog entries when this flag is set * Modifies feed.php to set this flag in response to either HTTP request option only_creates, or $conf['rss_only_creates']. * Modifies feed.php so that feeds may be restricted to a specific tag (or sequence of tag refinements using tagRefine) either by HTTP request option tag, or forcably via $conf['rss_tag']. * Modifies feed.php to allow $conf['rss_ns'] to force feeds to only expose pages in a specific namespace. The extra $conf[] options either allow simpler feed.php URLs by specifying defaults, or as a "security" option e.g. to ensure feeds only expose blog posts not wiki posts.
diff -urN dokuwiki-orig/feed.php dokuwiki-feed-enhancements/feed.php --- dokuwiki-orig/feed.php 2010-01-17 03:35:47.000000000 -0700 +++ dokuwiki-feed-enhancements/feed.php 2010-03-02 21:52:55.000000000 -0700 @@ -46,7 +46,7 @@ exit; } else { http_conditionalRequest(time()); - } +} // create new feed $rss = new DokuWikiFeedCreator(); @@ -78,6 +78,14 @@ $event->advise_after(); } +if($opt['tag']) { + if (plugin_isdisabled('tag') || (!$tag =& plugin_load('helper', 'tag'))) { + msg($this->getLang('missing_tagplugin'), -1); + } else { + $data = $tag->tagRefine($data, $opt['tag']); + } +} + rss_buildItems($rss, $data, $opt); $feed = $rss->createFeed($opt['feed_type'],'utf-8'); @@ -105,6 +113,8 @@ $opt['link_to'] = $_REQUEST['linkto']; $opt['item_content'] = $_REQUEST['content']; $opt['search_query'] = $_REQUEST['q']; + $opt['only_creates'] = $_REQUEST['only_creates']; + $opt['tag'] = $_REQUEST['tag']; if(!$opt['feed_type']) $opt['feed_type'] = $conf['rss_type']; if(!$opt['item_content']) $opt['item_content'] = $conf['rss_content']; @@ -134,6 +144,10 @@ $opt['mime_type'] = 'application/xml'; } + if ($conf['rss_ns']) $opt['namespace']=$conf['rss_ns']; + if ($conf['rss_only_creates']) $opt['only_creates']=$conf['rss_only_creates']; + if ($conf['rss_tag']) $opt['tag']=$conf['rss_tag']; + $eventData = array( 'opt' => &$opt, ); @@ -310,6 +324,7 @@ $flags = RECENTS_SKIP_DELETED; if(!$opt['show_minor']) $flags += RECENTS_SKIP_MINORS; + if($opt['only_creates']) $flags += RECENTS_ONLY_CREATES; $recents = getRecents(0,$opt['items'],$opt['namespace'],$flags); return $recents; diff -urN dokuwiki-orig/inc/changelog.php dokuwiki-feed-enhancements/inc/changelog.php --- dokuwiki-orig/inc/changelog.php 2010-01-17 03:35:47.000000000 -0700 +++ dokuwiki-feed-enhancements/inc/changelog.php 2010-03-02 21:19:37.000000000 -0700 @@ -254,6 +254,9 @@ // skip seen ones if(isset($seen[$recent['id']])) return false; + // skip anything but creates + if($recent['type']!==DOKU_CHANGE_TYPE_CREATE && ($flags & RECENTS_ONLY_CREATES)) return false; + // skip minors if($recent['type']===DOKU_CHANGE_TYPE_MINOR_EDIT && ($flags & RECENTS_SKIP_MINORS)) return false; diff -urN dokuwiki-orig/inc/common.php dokuwiki-feed-enhancements/inc/common.php --- dokuwiki-orig/inc/common.php 2010-01-17 03:35:47.000000000 -0700 +++ dokuwiki-feed-enhancements/inc/common.php 2010-03-02 21:19:45.000000000 -0700 @@ -21,6 +21,7 @@ define('RECENTS_SKIP_MINORS',4); define('RECENTS_SKIP_SUBSPACES',8); define('RECENTS_MEDIA_CHANGES',16); +define('RECENTS_ONLY_CREATES',32); /** * Wrapper around htmlspecialchars()