/* @access private */
var $type, $action, $comment, $params, $target, $doer;
/* @acess public */
- var $updateRecentChanges;
+ var $updateRecentChanges, $sendToUDP;
/**
* Constructor
* @param string $type One of '', 'block', 'protect', 'rights', 'delete',
* 'upload', 'move'
* @param bool $rc Whether to update recent changes as well as the logging table
+ * @param bool $udp Whether to send to the UDP feed
*/
- function __construct( $type, $rc = true ) {
+ function __construct( $type, $rc = true, $udp = true ) {
$this->type = $type;
$this->updateRecentChanges = $rc;
+ $this->sendToUDP = $udp;
}
protected function saveContent() {
RecentChange::notifyLog( $now, $titleObj, $this->doer, $rcComment, '',
$this->type, $this->action, $this->target, $this->comment, $this->params, $newId );
}
+ } else if( $this->sendToUDP ) {
+ # Notify external application via UDP.
+ # We send this to IRC but do not want to add it the RC table.
+ global $wgRC2UDPAddress, $wgRC2UDPOmitBots;
+ $titleObj = SpecialPage::getTitleFor( 'Log', $this->type );
+ $rcComment = $this->getRcComment();
+ $rc = RecentChange::newLogEntry( $now, $titleObj, $this->doer, $rcComment, '',
+ $this->type, $this->action, $this->target, $this->comment, $this->params, $newId );
+ if( $wgRC2UDPAddress && ( !$rc->getAttribute('rc_bot') || !$wgRC2UDPOmitBots ) ) {
+ RecentChange::sendToUDP( $rc->getIRCLine() );
+ }
}
return true;
}
$title = Title::makeTitleSafe( $rc->getAttribute( 'rc_namespace' ), $rc->getAttribute( 'rc_title' ) );
if( is_object( $title ) ) {
$params = self::buildParams( $rc, $auto );
- $log = new LogPage( 'patrol', false ); # False suppresses RC entries
+ $log = new LogPage( 'patrol', false, true ); # 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 ) ) {
- RecentChange::sendToUDP( $rc->getIRCLine() );
- }
return true;
}
return false;
public static function notifyLog( $timestamp, &$title, &$user, $actionComment, $ip='',
$type, $action, $target, $logComment, $params, $newId=0 )
+ {
+ $rc = self::newLogEntry( $timestamp, $title, $user, $actionComment, $ip, $type, $action,
+ $target, $logComment, $params, $newId );
+ $rc->save();
+ }
+
+ public static function newLogEntry( $timestamp, &$title, &$user, $actionComment, $ip='',
+ $type, $action, $target, $logComment, $params, $newId=0 )
{
global $wgRequest;
'lastTimestamp' => 0,
'actionComment' => $actionComment, // the comment appended to the action, passed from LogPage
);
- $rc->save();
+ return $rc;
}
# Initialises the members of this object from a mysql row object