aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorTero Kivinen <kivinen@iki.fi>2018-10-26 04:26:42 +0300
committerPhy <git@phy25.com>2020-03-09 20:21:11 -0400
commit68f43bcf6b19ba5d21836c5f2346d3ef1ad66f3f (patch)
tree283a1e916a57a01849ff168d3ac2dc1a1fa95fcd
parent7a0b5f30c2d63a8e403568877b6f3f07db70bdd6 (diff)
downloaddokuwiki-68f43bcf6b19ba5d21836c5f2346d3ef1ad66f3f.tar.gz
dokuwiki-68f43bcf6b19ba5d21836c5f2346d3ef1ad66f3f.zip
Implemented only_new option for RSS feed, so you can request RSS feed that contains only new files.
-rw-r--r--feed.php4
-rw-r--r--inc/changelog.php5
-rw-r--r--inc/common.php1
3 files changed, 10 insertions, 0 deletions
diff --git a/feed.php b/feed.php
index 2731ddb03..85ddd417d 100644
--- a/feed.php
+++ b/feed.php
@@ -133,6 +133,8 @@ function rss_parseOptions() {
'items' => array('int', 'num', $conf['recent']),
// Boolean, only used in rc mode
'show_minor' => array('bool', 'minor', false),
+ // Boolean, only used in rc mode
+ 'only_new' => array('bool', 'onlynewpages', false),
// String, only used in list mode
'sort' => array('str', 'sort', 'natural'),
// String, only used in search mode
@@ -146,6 +148,7 @@ function rss_parseOptions() {
$opt['items'] = max(0, (int) $opt['items']);
$opt['show_minor'] = (bool) $opt['show_minor'];
+ $opt['only_new'] = (bool) $opt['only_new'];
$opt['sort'] = valid_input_set('sort', array('default' => 'natural', 'date'), $opt);
$opt['guardmail'] = ($conf['mailguard'] != '' && $conf['mailguard'] != 'none');
@@ -469,6 +472,7 @@ function rssRecentChanges($opt) {
$flags = 0;
if(!$conf['rss_show_deleted']) $flags += RECENTS_SKIP_DELETED;
if(!$opt['show_minor']) $flags += RECENTS_SKIP_MINORS;
+ if($opt['only_new']) $flags += RECENTS_ONLY_NEW_PAGES;
if($opt['content_type'] == 'media' && $conf['mediarevisions']) $flags += RECENTS_MEDIA_CHANGES;
if($opt['content_type'] == 'both' && $conf['mediarevisions']) $flags += RECENTS_MEDIA_PAGES_MIXED;
diff --git a/inc/changelog.php b/inc/changelog.php
index 652016cb8..d9b1576d0 100644
--- a/inc/changelog.php
+++ b/inc/changelog.php
@@ -205,6 +205,7 @@ function addMediaLogEntry(
*
* RECENTS_SKIP_DELETED - don't include deleted pages
* RECENTS_SKIP_MINORS - don't include minor changes
+ * RECENTS_ONLY_NEW_PAGES - only include new created pages
* RECENTS_SKIP_SUBSPACES - don't include subspaces
* RECENTS_MEDIA_CHANGES - return media changes instead of page changes
* RECENTS_MEDIA_PAGES_MIXED - return both media changes and page changes
@@ -299,6 +300,7 @@ function getRecents($first,$num,$ns='',$flags=0){
*
* RECENTS_SKIP_DELETED - don't include deleted pages
* RECENTS_SKIP_MINORS - don't include minor changes
+ * RECENTS_ONLY_NEW_PAGES - only include new created pages
* RECENTS_SKIP_SUBSPACES - don't include subspaces
* RECENTS_MEDIA_CHANGES - return media changes instead of page changes
*
@@ -373,6 +375,9 @@ function _handleRecent($line,$ns,$flags,&$seen){
// skip seen ones
if(isset($seen[$recent['id']])) return false;
+ // skip changes, of only new pages are requested
+ if($recent['type']!==DOKU_CHANGE_TYPE_CREATE && ($flags & RECENTS_ONLY_NEW_PAGES)) return false;
+
// skip minors
if($recent['type']===DOKU_CHANGE_TYPE_MINOR_EDIT && ($flags & RECENTS_SKIP_MINORS)) return false;
diff --git a/inc/common.php b/inc/common.php
index c462934b2..bcf0edb69 100644
--- a/inc/common.php
+++ b/inc/common.php
@@ -22,6 +22,7 @@ define('RECENTS_SKIP_MINORS', 4);
define('RECENTS_SKIP_SUBSPACES', 8);
define('RECENTS_MEDIA_CHANGES', 16);
define('RECENTS_MEDIA_PAGES_MIXED', 32);
+define('RECENTS_ONLY_NEW_PAGES', 64);
/**
* Wrapper around htmlspecialchars()