r101834 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101833‎ | r101834 | r101835 >
Date:17:07, 3 November 2011
Author:nikerabbit
Status:resolved
Tags:
Comment:
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
Modified paths:
  • /trunk/phase3/includes/RecentChange.php (modified) (history)
  • /trunk/phase3/includes/logging/LogEntry.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/RecentChange.php
@@ -158,10 +158,10 @@
159159
160160 /**
161161 * Writes the data in this object to the database
 162+ * @param $noudp bool
162163 */
163 - public function save() {
164 - global $wgLocalInterwiki, $wgPutIPinRC, $wgRC2UDPAddress, $wgRC2UDPOmitBots;
165 - $fname = 'RecentChange::save';
 164+ public function save( $noudp = false ) {
 165+ global $wgLocalInterwiki, $wgPutIPinRC;
166166
167167 $dbw = wfGetDB( DB_MASTER );
168168 if( !is_array($this->mExtra) ) {
@@ -189,7 +189,7 @@
190190 }
191191
192192 # Insert new row
193 - $dbw->insert( 'recentchanges', $this->mAttribs, $fname );
 193+ $dbw->insert( 'recentchanges', $this->mAttribs, __METHOD__ );
194194
195195 # Set the ID
196196 $this->mAttribs['rc_id'] = $dbw->insertId();
@@ -198,8 +198,8 @@
199199 wfRunHooks( 'RecentChange_save', array( &$this ) );
200200
201201 # Notify external application via UDP
202 - if( $wgRC2UDPAddress && ( !$this->mAttribs['rc_bot'] || !$wgRC2UDPOmitBots ) ) {
203 - self::sendToUDP( $this->getIRCLine() );
 202+ if ( !$noudp ) {
 203+ $this->notifyRC2UDP()
204204 }
205205
206206 # E-mail notifications
Index: trunk/phase3/includes/logging/LogEntry.php
@@ -417,7 +417,7 @@
418418 );
419419
420420 if ( $to === 'rc' || $to === 'rcandudp' ) {
421 - $rc->save();
 421+ $rc->save( 'pleasedontudp' );
422422 }
423423
424424 if ( $to === 'udp' || $to === 'rcandudp' ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r101836Followup r101834 - this time testednikerabbit17:09, 3 November 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r45725Added notifyRC2UDP() convenience functionaaron01:45, 14 January 2009

Status & tagging log