Quick ugly fix to avoid duplicate log entries in rc feed.
authorNiklas Laxström <nikerabbit@users.mediawiki.org>
Thu, 3 Nov 2011 17:07:29 +0000 (17:07 +0000)
committerNiklas Laxström <nikerabbit@users.mediawiki.org>
Thu, 3 Nov 2011 17:07:29 +0000 (17:07 +0000)
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

includes/RecentChange.php
includes/logging/LogEntry.php

index c87b37e..fd5325c 100644 (file)
@@ -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
index 0373d75..31ef99a 100644 (file)
@@ -417,7 +417,7 @@ class ManualLogEntry extends LogEntryBase {
                );
 
                if ( $to === 'rc' || $to === 'rcandudp' ) {
-                       $rc->save();
+                       $rc->save( 'pleasedontudp' );
                }
 
                if ( $to === 'udp' || $to === 'rcandudp' ) {