From: Niklas Laxström Date: Thu, 3 Nov 2011 17:07:29 +0000 (+0000) Subject: Quick ugly fix to avoid duplicate log entries in rc feed. X-Git-Tag: 1.31.0-rc.0~26732 X-Git-Url: http://git.cyclocoop.org/%22.%24h.%22?a=commitdiff_plain;h=6470c757216521212362a019debd78c285f64dcb;p=lhc%2Fweb%2Fwiklou.git Quick ugly fix to avoid duplicate log entries in rc feed. I didn't think that save() would send lines, since there was function to do that (added in r45725 - duplicating existing code). This part of codebase could use much TLC --- diff --git a/includes/RecentChange.php b/includes/RecentChange.php index c87b37e70b..fd5325ca13 100644 --- a/includes/RecentChange.php +++ b/includes/RecentChange.php @@ -158,10 +158,10 @@ class RecentChange { /** * Writes the data in this object to the database + * @param $noudp bool */ - public function save() { - global $wgLocalInterwiki, $wgPutIPinRC, $wgRC2UDPAddress, $wgRC2UDPOmitBots; - $fname = 'RecentChange::save'; + public function save( $noudp = false ) { + global $wgLocalInterwiki, $wgPutIPinRC; $dbw = wfGetDB( DB_MASTER ); if( !is_array($this->mExtra) ) { @@ -189,7 +189,7 @@ class RecentChange { } # Insert new row - $dbw->insert( 'recentchanges', $this->mAttribs, $fname ); + $dbw->insert( 'recentchanges', $this->mAttribs, __METHOD__ ); # Set the ID $this->mAttribs['rc_id'] = $dbw->insertId(); @@ -198,8 +198,8 @@ class RecentChange { wfRunHooks( 'RecentChange_save', array( &$this ) ); # Notify external application via UDP - if( $wgRC2UDPAddress && ( !$this->mAttribs['rc_bot'] || !$wgRC2UDPOmitBots ) ) { - self::sendToUDP( $this->getIRCLine() ); + if ( !$noudp ) { + $this->notifyRC2UDP() } # E-mail notifications diff --git a/includes/logging/LogEntry.php b/includes/logging/LogEntry.php index 0373d75f98..31ef99a156 100644 --- a/includes/logging/LogEntry.php +++ b/includes/logging/LogEntry.php @@ -417,7 +417,7 @@ class ManualLogEntry extends LogEntryBase { ); if ( $to === 'rc' || $to === 'rcandudp' ) { - $rc->save(); + $rc->save( 'pleasedontudp' ); } if ( $to === 'udp' || $to === 'rcandudp' ) {