* The common options are:
* * 'uri' -- the address to which the notices are to be sent.
* * 'formatter' -- the class name (implementing RCFeedFormatter) which will
- * produce the text to send.
+ * produce the text to send. This can also be an object of the class.
* * '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
/**
* Notify all the feeds about the change.
+ * @param array $feeds Optional feeds to send to, defaults to $wgRCFeeds
*/
- public function notifyRCFeeds() {
+ public function notifyRCFeeds( array $feeds = null ) {
global $wgRCFeeds;
+ if ( $feeds === null ) {
+ $feeds = $wgRCFeeds;
+ }
$performer = $this->getPerformer();
- foreach ( $wgRCFeeds as $feed ) {
+ foreach ( $feeds as $feed ) {
$feed += array(
'omit_bots' => false,
'omit_anon' => false,
}
/** @var $formatter RCFeedFormatter */
- $formatter = new $feed['formatter']();
+ $formatter = is_object( $feed['formatter'] ) ? $feed['formatter'] : new $feed['formatter']();
$line = $formatter->getLine( $feed, $this, $actionComment );
$engine->send( $feed, $line );