r41220 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r41219‎ | r41220 | r41221 >
Date:08:36, 24 September 2008
Author:tstarling
Status:old
Tags:
Comment:
Fix unnecessary GlobalFunctions.php bloat from r41148
Modified paths:
  • /trunk/phase3/includes/GlobalFunctions.php (modified) (history)
  • /trunk/phase3/includes/RecentChange.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/RecentChange.php
@@ -210,7 +210,7 @@
211211
212212 # Notify external application via UDP
213213 if ( $wgRC2UDPAddress && ( !$this->mAttribs['rc_bot'] || !$wgRC2UDPOmitBots ) ) {
214 - wfRecentChange2UDP( $this->getIRCLine() );
 214+ self::sendToUDP( $this->getIRCLine() );
215215 }
216216
217217 # E-mail notifications
@@ -240,6 +240,23 @@
241241 }
242242
243243 /**
 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+ /**
244261 * Mark a given change as patrolled
245262 *
246263 * @param mixed $change RecentChange or corresponding rc_id
Index: trunk/phase3/includes/GlobalFunctions.php
@@ -2907,20 +2907,3 @@
29082908 $name = preg_replace ( "/[^".Title::legalChars()."]|:/", '-', $name );
29092909 return $name;
29102910 }
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 -}

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r41148Refactor RC2UDP code someaaron12:22, 22 September 2008