Follows-up 39a6e3dc4d (I8be497c623c5d92).
* Improve documentation all around and advertise 'class'
everywhere instead of 'uri'.
* Add test coverage for RCFeed::factory().
* Deprecate the $wgRCEngines "uri to class" mapping in favour
of specifying "class" directly in $wgRCFeeds.
* Deprecate RCFeedEngine in favour of FormattedRCFeed.
Convert to class_alias so that UDPRCFeedEngine no longer has
to extend the deprecated class name explicitly (for instanceof compat).
* Hard-deprecate RecentChange::getEngine.
Bug: T250628
Depends-On: Ie939e1d06b9ee2d841ec7256c8d24cc4e7e386dd
Change-Id: Ib6758d724c7200404c89c7ab157aa55f1cad9763
53 lines
1.5 KiB
PHP
53 lines
1.5 KiB
PHP
<?php
|
|
/**
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License along
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
* http://www.gnu.org/copyleft/gpl.html
|
|
*
|
|
* @file
|
|
*/
|
|
|
|
/**
|
|
* Send recent change notifications to a destination address over UDP.
|
|
*
|
|
* Parameters:
|
|
* - `formatter`: (Required) Which RCFeedFormatter class to use.
|
|
* - `uri`: (Required) Where to send the messages.
|
|
*
|
|
* @par Example:
|
|
* @code
|
|
* $wgRCFeeds['rc-to-udp'] = [
|
|
* 'class' => 'UDPRCFeedEngine',
|
|
* 'formatter' => 'JSONRCFeedFormatter',
|
|
* 'uri' => 'udp://localhost:1336',
|
|
* ];
|
|
* @endcode
|
|
*
|
|
* @see $wgRCFeeds
|
|
* @since 1.22
|
|
*/
|
|
class UDPRCFeedEngine extends FormattedRCFeed {
|
|
|
|
/**
|
|
* @see FormattedRCFeed::send
|
|
* @param array $feed
|
|
* @param string $line
|
|
* @return bool
|
|
*/
|
|
public function send( array $feed, $line ) {
|
|
$transport = UDPTransport::newFromString( $feed['uri'] );
|
|
$transport->emit( $line );
|
|
return true;
|
|
}
|
|
}
|