From 48c3231e32f8486b54c92770d821736019476a36 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Niklas=20Laxstr=C3=B6m?= Date: Thu, 24 Jun 2010 06:20:11 +0000 Subject: [PATCH] Apply patch from bug 24104 by John Du Hart for allowing custom port. Also updated the function documentation while at it. --- includes/RecentChange.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/includes/RecentChange.php b/includes/RecentChange.php index 51b608d81a..38c6b74b2a 100644 --- a/includes/RecentChange.php +++ b/includes/RecentChange.php @@ -208,24 +208,27 @@ class RecentChange { } /** - * Send some text to UDP + * Send some text to UDP. + * @see RecentChange::cleanupForIRC * @param $line String: text to send - * @param $prefix String - * @param $address String: address + * @param $address String: defaults to $wgRC2UDPAddress. + * @param $prefix String: defaults to $wgRC2UDPPrefix. + * @param $port Int: defaults to $wgRC2UDPPort. (Since 1.17) * @return Boolean: success */ - public static function sendToUDP( $line, $address = '', $prefix = '' ) { + public static function sendToUDP( $line, $address = '', $prefix = '', $port = '' ) { global $wgRC2UDPAddress, $wgRC2UDPPrefix, $wgRC2UDPPort; # Assume default for standard RC case $address = $address ? $address : $wgRC2UDPAddress; $prefix = $prefix ? $prefix : $wgRC2UDPPrefix; + $port = $port ? $port : $wgRC2UDPPort; # Notify external application via UDP if( $address ) { $conn = socket_create( AF_INET, SOCK_DGRAM, SOL_UDP ); if( $conn ) { $line = $prefix . $line; wfDebug( __METHOD__ . ": sending UDP line: $line\n" ); - socket_sendto( $conn, $line, strlen($line), 0, $address, $wgRC2UDPPort ); + socket_sendto( $conn, $line, strlen($line), 0, $address, $port ); socket_close( $conn ); return true; } else { -- 2.20.1