| Index: trunk/phase3/includes/RecentChange.php |
| — | — | @@ -476,6 +476,14 @@ |
| 477 | 477 | public static function notifyLog( $timestamp, &$title, &$user, $actionComment, $ip='', |
| 478 | 478 | $type, $action, $target, $logComment, $params, $newId=0 ) |
| 479 | 479 | { |
| | 480 | + $rc = self::newLogEntry( $timestamp, $title, $user, $actionComment, $ip, $type, $action, |
| | 481 | + $target, $logComment, $params, $newId ); |
| | 482 | + $rc->save(); |
| | 483 | + } |
| | 484 | + |
| | 485 | + public static function newLogEntry( $timestamp, &$title, &$user, $actionComment, $ip='', |
| | 486 | + $type, $action, $target, $logComment, $params, $newId=0 ) |
| | 487 | + { |
| 480 | 488 | global $wgRequest; |
| 481 | 489 | |
| 482 | 490 | if( !$ip ) { |
| — | — | @@ -518,7 +526,7 @@ |
| 519 | 527 | 'lastTimestamp' => 0, |
| 520 | 528 | 'actionComment' => $actionComment, // the comment appended to the action, passed from LogPage |
| 521 | 529 | ); |
| 522 | | - $rc->save(); |
| | 530 | + return $rc; |
| 523 | 531 | } |
| 524 | 532 | |
| 525 | 533 | # Initialises the members of this object from a mysql row object |
| Index: trunk/phase3/includes/PatrolLog.php |
| — | — | @@ -23,14 +23,8 @@ |
| 24 | 24 | $title = Title::makeTitleSafe( $rc->getAttribute( 'rc_namespace' ), $rc->getAttribute( 'rc_title' ) ); |
| 25 | 25 | if( is_object( $title ) ) { |
| 26 | 26 | $params = self::buildParams( $rc, $auto ); |
| 27 | | - $log = new LogPage( 'patrol', false ); # False suppresses RC entries |
| | 27 | + $log = new LogPage( 'patrol', false, true ); # False suppresses RC entries |
| 28 | 28 | $log->addEntry( 'patrol', $title, '', $params ); |
| 29 | | - # Notify external application via UDP. |
| 30 | | - # We send this to IRC but do not want to add it the RC table. |
| 31 | | - global $wgRC2UDPAddress, $wgRC2UDPOmitBots; |
| 32 | | - if( $wgRC2UDPAddress && ( !$rc->getAttribute('rc_bot') || !$wgRC2UDPOmitBots ) ) { |
| 33 | | - RecentChange::sendToUDP( $rc->getIRCLine() ); |
| 34 | | - } |
| 35 | 29 | return true; |
| 36 | 30 | } |
| 37 | 31 | return false; |
| Index: trunk/phase3/includes/LogPage.php |
| — | — | @@ -37,7 +37,7 @@ |
| 38 | 38 | /* @access private */ |
| 39 | 39 | var $type, $action, $comment, $params, $target, $doer; |
| 40 | 40 | /* @acess public */ |
| 41 | | - var $updateRecentChanges; |
| | 41 | + var $updateRecentChanges, $sendToUDP; |
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | 44 | * Constructor |
| — | — | @@ -45,10 +45,12 @@ |
| 46 | 46 | * @param string $type One of '', 'block', 'protect', 'rights', 'delete', |
| 47 | 47 | * 'upload', 'move' |
| 48 | 48 | * @param bool $rc Whether to update recent changes as well as the logging table |
| | 49 | + * @param bool $udp Whether to send to the UDP feed |
| 49 | 50 | */ |
| 50 | | - function __construct( $type, $rc = true ) { |
| | 51 | + function __construct( $type, $rc = true, $udp = true ) { |
| 51 | 52 | $this->type = $type; |
| 52 | 53 | $this->updateRecentChanges = $rc; |
| | 54 | + $this->sendToUDP = $udp; |
| 53 | 55 | } |
| 54 | 56 | |
| 55 | 57 | protected function saveContent() { |
| — | — | @@ -85,6 +87,17 @@ |
| 86 | 88 | RecentChange::notifyLog( $now, $titleObj, $this->doer, $rcComment, '', |
| 87 | 89 | $this->type, $this->action, $this->target, $this->comment, $this->params, $newId ); |
| 88 | 90 | } |
| | 91 | + } else if( $this->sendToUDP ) { |
| | 92 | + # Notify external application via UDP. |
| | 93 | + # We send this to IRC but do not want to add it the RC table. |
| | 94 | + global $wgRC2UDPAddress, $wgRC2UDPOmitBots; |
| | 95 | + $titleObj = SpecialPage::getTitleFor( 'Log', $this->type ); |
| | 96 | + $rcComment = $this->getRcComment(); |
| | 97 | + $rc = RecentChange::newLogEntry( $now, $titleObj, $this->doer, $rcComment, '', |
| | 98 | + $this->type, $this->action, $this->target, $this->comment, $this->params, $newId ); |
| | 99 | + if( $wgRC2UDPAddress && ( !$rc->getAttribute('rc_bot') || !$wgRC2UDPOmitBots ) ) { |
| | 100 | + RecentChange::sendToUDP( $rc->getIRCLine() ); |
| | 101 | + } |
| 89 | 102 | } |
| 90 | 103 | return true; |
| 91 | 104 | } |