r41938 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r41937‎ | r41938 | r41939 >
Date:16:01, 10 October 2008
Author:aaron
Status:old (Comments)
Tags:
Comment:
Tweak udp function to allow any prefix
Modified paths:
  • /trunk/phase3/includes/RecentChange.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/RecentChange.php
@@ -140,7 +140,7 @@
141141 # Writes the data in this object to the database
142142 function save()
143143 {
144 - global $wgLocalInterwiki, $wgPutIPinRC, $wgRC2UDPAddress, $wgRC2UDPOmitBots;
 144+ global $wgLocalInterwiki, $wgPutIPinRC, $wgRC2UDPAddress, $wgRC2UDPPrefix, $wgRC2UDPOmitBots;
145145 $fname = 'RecentChange::save';
146146
147147 $dbw = wfGetDB( DB_MASTER );
@@ -176,7 +176,7 @@
177177
178178 # Notify external application via UDP
179179 if ( $wgRC2UDPAddress && ( !$this->mAttribs['rc_bot'] || !$wgRC2UDPOmitBots ) ) {
180 - self::sendToUDP( $this->getIRCLine() );
 180+ self::sendToUDP( $wgRC2UDPPrefix, $this->getIRCLine() );
181181 }
182182
183183 # E-mail notifications
@@ -209,13 +209,13 @@
210210 * Send some text to UDP
211211 * @param string $line
212212 */
213 - static function sendToUDP( $line ) {
 213+ public static function sendToUDP( $prefix, $line ) {
214214 global $wgRC2UDPAddress, $wgRC2UDPPort, $wgRC2UDPPrefix;
215215 # Notify external application via UDP
216216 if( $wgRC2UDPAddress ) {
217217 $conn = socket_create( AF_INET, SOCK_DGRAM, SOL_UDP );
218218 if( $conn ) {
219 - $line = $wgRC2UDPPrefix . $line;
 219+ $line = $prefix . $line;
220220 socket_sendto( $conn, $line, strlen($line), 0, $wgRC2UDPAddress, $wgRC2UDPPort );
221221 socket_close( $conn );
222222 }

Comments

#Comment by Brion VIBBER (talk | contribs)   02:08, 13 October 2008

Hmm...

This seems oddly factored to me. It'll let you point something at another channel on the same IRC server, but won't let you connect to another bot (say to hit another server), plus you have to cart around one of the config vars for the general case.

#Comment by Voice of All (talk | contribs)   06:17, 13 October 2008

Refactored in r42020

Status & tagging log