From b1928d352bc403c7198b1beaebda7281ca9e3036 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Fri, 9 Jan 2009 17:57:22 +0000 Subject: [PATCH] Send manual patrols to IRC (bug 16604) --- includes/PatrolLog.php | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/includes/PatrolLog.php b/includes/PatrolLog.php index 5f305c1006..9566888404 100644 --- a/includes/PatrolLog.php +++ b/includes/PatrolLog.php @@ -14,22 +14,26 @@ class PatrolLog { * @param mixed $change Change identifier or RecentChange object * @param bool $auto Was this patrol event automatic? */ - public static function record( $change, $auto = false ) { - if( !( is_object( $change ) && $change instanceof RecentChange ) ) { - $change = RecentChange::newFromId( $change ); - if( !is_object( $change ) ) + public static function record( $rc, $auto = false ) { + if( !( $rc instanceof RecentChange ) ) { + $rc = RecentChange::newFromId( $rc ); + if( !is_object( $rc ) ) return false; } - $title = Title::makeTitleSafe( $change->getAttribute( 'rc_namespace' ), - $change->getAttribute( 'rc_title' ) ); + $title = Title::makeTitleSafe( $rc->getAttribute( 'rc_namespace' ), $rc->getAttribute( 'rc_title' ) ); if( is_object( $title ) ) { - $params = self::buildParams( $change, $auto ); + $params = self::buildParams( $rc, $auto ); $log = new LogPage( 'patrol', false ); # False suppresses RC entries $log->addEntry( 'patrol', $title, '', $params ); + # Notify external application via UDP. + # We send this to IRC but do not want to add it the RC table. + global $wgRC2UDPAddress, $wgRC2UDPOmitBots; + if( $wgRC2UDPAddress && ( !$rc->getAttribute('rc_bot') || !$wgRC2UDPOmitBots ) ) { + self::sendToUDP( $rc->getIRCLine() ); + } return true; - } else { - return false; } + return false; } /** -- 2.20.1