From 4211404e0256d9e5cf8ca37682bdc08382501214 Mon Sep 17 00:00:00 2001 From: Tyler Anthony Romeo Date: Thu, 6 Feb 2014 03:20:27 -0500 Subject: [PATCH] Added more filter options to $wgRCFeeds Changed RecentChange::notifyRCFeeds() to allow more filter options than just omit_bots. In order to mirror the on-wiki Special:RecentChanges UI, the options omit_anon, omit_user, omit_minor, omit_patrolled were added, which omits anonymous, registered, minor, and patrolled edits, respectively. Bug: 60941 Change-Id: I716c741f1f7d42b6506a97e9a5733beac23ac16c --- includes/DefaultSettings.php | 4 ++++ includes/changes/RecentChange.php | 16 ++++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index eb8ba5ca2a..8f3de1adce 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -5637,6 +5637,10 @@ $wgRC2UDPOmitBots = false; * * 'formatter' -- the class name (implementing RCFeedFormatter) which will * produce the text to send. * * 'omit_bots' -- whether the bot edits should be in the feed + * * 'omit_anon' -- whether anonymous edits should be in the feed + * * 'omit_user' -- whether edits by registered users should be in the feed + * * 'omit_minor' -- whether minor edits should be in the feed + * * 'omit_patrolled' -- whether patrolled edits should be in the feed * The IRC-specific options are: * * 'add_interwiki_prefix' -- whether the titles should be prefixed with * the first entry in the $wgLocalInterwikis array (or the value of diff --git a/includes/changes/RecentChange.php b/includes/changes/RecentChange.php index 072aa12f1e..7705c1078c 100644 --- a/includes/changes/RecentChange.php +++ b/includes/changes/RecentChange.php @@ -331,11 +331,23 @@ class RecentChange { public function notifyRCFeeds() { global $wgRCFeeds; + $performer = $this->getPerformer(); + foreach ( $wgRCFeeds as $feed ) { - $omitBots = isset( $feed['omit_bots'] ) ? $feed['omit_bots'] : false; + $feed += array( + 'omit_bots' => false, + 'omit_anon' => false, + 'omit_user' => false, + 'omit_minor' => false, + 'omit_patrolled' => false, + ); if ( - ( $omitBots && $this->mAttribs['rc_bot'] ) || + ( $feed['omit_bots'] && $this->mAttribs['rc_bot'] ) || + ( $feed['omit_anon'] && $performer->isAnon() ) || + ( $feed['omit_user'] && !$performer->isAnon() ) || + ( $feed['omit_minor'] && $this->mAttribs['rc_minor'] ) || + ( $feed['omit_patrolled'] && $this->mAttribs['rc_patrolled'] ) || $this->mAttribs['rc_type'] == RC_EXTERNAL ) { continue; -- 2.20.1