Index: trunk/phase3/includes/RecentChange.php |
— | — | @@ -210,7 +210,7 @@ |
211 | 211 | |
212 | 212 | # Notify external application via UDP |
213 | 213 | if ( $wgRC2UDPAddress && ( !$this->mAttribs['rc_bot'] || !$wgRC2UDPOmitBots ) ) { |
214 | | - wfRecentChange2UDP( $this->getIRCLine() ); |
| 214 | + self::sendToUDP( $this->getIRCLine() ); |
215 | 215 | } |
216 | 216 | |
217 | 217 | # E-mail notifications |
— | — | @@ -240,6 +240,23 @@ |
241 | 241 | } |
242 | 242 | |
243 | 243 | /** |
| 244 | + * Send some text to UDP |
| 245 | + * @param string $line |
| 246 | + */ |
| 247 | + static function sendToUDP( $line ) { |
| 248 | + global $wgRC2UDPAddress, $wgRC2UDPPort, $wgRC2UDPPrefix; |
| 249 | + # Notify external application via UDP |
| 250 | + if( $wgRC2UDPAddress ) { |
| 251 | + $conn = socket_create( AF_INET, SOCK_DGRAM, SOL_UDP ); |
| 252 | + if( $conn ) { |
| 253 | + $line = $wgRC2UDPPrefix . $line; |
| 254 | + socket_sendto( $conn, $line, strlen($line), 0, $wgRC2UDPAddress, $wgRC2UDPPort ); |
| 255 | + socket_close( $conn ); |
| 256 | + } |
| 257 | + } |
| 258 | + } |
| 259 | + |
| 260 | + /** |
244 | 261 | * Mark a given change as patrolled |
245 | 262 | * |
246 | 263 | * @param mixed $change RecentChange or corresponding rc_id |
Index: trunk/phase3/includes/GlobalFunctions.php |
— | — | @@ -2907,20 +2907,3 @@ |
2908 | 2908 | $name = preg_replace ( "/[^".Title::legalChars()."]|:/", '-', $name ); |
2909 | 2909 | return $name; |
2910 | 2910 | } |
2911 | | - |
2912 | | -/** |
2913 | | - * Send some text to |
2914 | | - * @param string $line |
2915 | | - */ |
2916 | | -function wfRecentChange2UDP( $line ) { |
2917 | | - global $wgRC2UDPAddress, $wgRC2UDPPort, $wgRC2UDPPrefix; |
2918 | | - # Notify external application via UDP |
2919 | | - if( $wgRC2UDPAddress ) { |
2920 | | - $conn = socket_create( AF_INET, SOCK_DGRAM, SOL_UDP ); |
2921 | | - if( $conn ) { |
2922 | | - $line = $wgRC2UDPPrefix . $line; |
2923 | | - socket_sendto( $conn, $line, strlen($line), 0, $wgRC2UDPAddress, $wgRC2UDPPort ); |
2924 | | - socket_close( $conn ); |
2925 | | - } |
2926 | | - } |
2927 | | -} |