From 9db190c7e736ec8d063187d4241b59feaf7dc2d1 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Wed, 22 Jun 2011 11:28:20 +0200 Subject: update to MediaWiki 1.17.0 --- includes/RecentChange.php | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'includes/RecentChange.php') diff --git a/includes/RecentChange.php b/includes/RecentChange.php index 51b608d8..803420f6 100644 --- a/includes/RecentChange.php +++ b/includes/RecentChange.php @@ -2,6 +2,7 @@ /** * Utility class for creating new RC entries + * * mAttribs: * rc_id id of the row in the recentchanges table * rc_timestamp time the entry was made @@ -73,7 +74,6 @@ class RecentChange { $res = $dbr->select( 'recentchanges', '*', array( 'rc_id' => $rcid ), __METHOD__ ); if( $res && $dbr->numRows( $res ) > 0 ) { $row = $dbr->fetchObject( $res ); - $dbr->freeResult( $res ); return self::newFromRow( $row ); } else { return null; @@ -115,6 +115,10 @@ class RecentChange { $this->mExtra = $extra; } + /** + * + * @return Title + */ public function &getTitle() { if( $this->mTitle === false ) { $this->mTitle = Title::makeTitle( $this->mAttribs['rc_namespace'], $this->mAttribs['rc_title'] ); @@ -208,24 +212,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 { @@ -249,7 +256,7 @@ class RecentChange { * * @param $change Mixed: RecentChange or corresponding rc_id * @param $auto Boolean: for automatic patrol - * @return See doMarkPatrolled(), or null if $change is not an existing rc_id + * @return Array See doMarkPatrolled(), or null if $change is not an existing rc_id */ public static function markPatrolled( $change, $auto = false ) { $change = $change instanceof RecentChange @@ -576,7 +583,7 @@ class RecentChange { /** * Get an attribute value * - * @param $name Attribute name + * @param $name String Attribute name * @return mixed */ public function getAttribute( $name ) { @@ -667,7 +674,7 @@ class RecentChange { $flag .= ($rc_new ? "N" : "") . ($rc_minor ? "M" : "") . ($rc_bot ? "B" : ""); } - if ( $wgRC2UDPInterwikiPrefix === true ) { + if ( $wgRC2UDPInterwikiPrefix === true && $wgLocalInterwiki !== false ) { $prefix = $wgLocalInterwiki; } elseif ( $wgRC2UDPInterwikiPrefix ) { $prefix = $wgRC2UDPInterwikiPrefix; -- cgit v1.2.2