diff options
Diffstat (limited to 'includes/RecentChange.php')
-rw-r--r-- | includes/RecentChange.php | 64 |
1 files changed, 40 insertions, 24 deletions
diff --git a/includes/RecentChange.php b/includes/RecentChange.php index f03fbcbb..8e3f1107 100644 --- a/includes/RecentChange.php +++ b/includes/RecentChange.php @@ -166,6 +166,9 @@ class RecentChange # Set the ID $this->mAttribs['rc_id'] = $dbw->insertId(); + + # Notify extensions + wfRunHooks( 'RecentChange_save', array( &$this ) ); # Notify external application via UDP if( $wgRC2UDPAddress && ( !$this->mAttribs['rc_bot'] || !$wgRC2UDPOmitBots ) ) { @@ -193,9 +196,14 @@ class RecentChange $this->mAttribs['rc_minor'], $this->mAttribs['rc_last_oldid'] ); } - - # Notify extensions - wfRunHooks( 'RecentChange_save', array( &$this ) ); + } + + public function notifyRC2UDP() { + global $wgRC2UDPAddress, $wgRC2UDPOmitBots; + # Notify external application via UDP + if( $wgRC2UDPAddress && ( !$this->mAttribs['rc_bot'] || !$wgRC2UDPOmitBots ) ) { + self::sendToUDP( $this->getIRCLine() ); + } } /** @@ -227,12 +235,12 @@ class RecentChange } /** - * Remove newlines and carriage returns + * Remove newlines, carriage returns and decode html entites * @param string $line * @return string */ public static function cleanupForIRC( $text ) { - return str_replace(array("\n", "\r"), array("", ""), $text); + return Sanitizer::decodeCharReferences( str_replace( array( "\n", "\r" ), array( "", "" ), $text ) ); } /** @@ -318,9 +326,7 @@ class RecentChange { if( !$ip ) { $ip = wfGetIP(); - if( !$ip ) { - $ip = ''; - } + if( !$ip ) $ip = ''; } $rc = new RecentChange; @@ -372,9 +378,7 @@ class RecentChange { if( !$ip ) { $ip = wfGetIP(); - if( !$ip ) { - $ip = ''; - } + if( !$ip ) $ip = ''; } $rc = new RecentChange; @@ -420,12 +424,9 @@ class RecentChange public static function notifyMove( $timestamp, &$oldTitle, &$newTitle, &$user, $comment, $ip='', $overRedir = false ) { global $wgRequest; - if( !$ip ) { $ip = wfGetIP(); - if( !$ip ) { - $ip = ''; - } + if( !$ip ) $ip = ''; } $rc = new RecentChange; @@ -473,16 +474,27 @@ class RecentChange RecentChange::notifyMove( $timestamp, $oldTitle, $newTitle, $user, $comment, $ip, true ); } - public static function notifyLog( $timestamp, &$title, &$user, $actionComment, $ip='', - $type, $action, $target, $logComment, $params, $newId=0 ) + public static function notifyLog( $timestamp, &$title, &$user, $actionComment, $ip='', $type, + $action, $target, $logComment, $params, $newId=0 ) { - global $wgRequest; + global $wgLogRestrictions; + # Don't add private logs to RC! + if( isset($wgLogRestrictions[$type]) && $wgLogRestrictions[$type] != '*' ) { + return false; + } + $rc = self::newLogEntry( $timestamp, $title, $user, $actionComment, $ip, $type, $action, + $target, $logComment, $params, $newId ); + $rc->save(); + return true; + } + public static function newLogEntry( $timestamp, &$title, &$user, $actionComment, $ip='', + $type, $action, $target, $logComment, $params, $newId=0 ) + { + global $wgRequest; if( !$ip ) { $ip = wfGetIP(); - if( !$ip ) { - $ip = ''; - } + if( !$ip ) $ip = ''; } $rc = new RecentChange; @@ -518,7 +530,7 @@ class RecentChange '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 @@ -589,7 +601,7 @@ class RecentChange return $trail; } - protected function getIRCLine() { + public function getIRCLine() { global $wgUseRCPatrol, $wgUseNPPatrol, $wgRC2UDPInterwikiPrefix, $wgLocalInterwiki; // FIXME: Would be good to replace these 2 extract() calls with something more explicit @@ -643,7 +655,11 @@ class RecentChange $flag = $rc_log_action; } else { $comment = self::cleanupForIRC( $rc_comment ); - $flag = ($rc_new ? "N" : "") . ($rc_minor ? "M" : "") . ($rc_bot ? "B" : ""); + $flag = ''; + if( !$rc_patrolled && ($wgUseRCPatrol || $rc_new && $wgUseNPPatrol) ) { + $flag .= '!'; + } + $flag .= ($rc_new ? "N" : "") . ($rc_minor ? "M" : "") . ($rc_bot ? "B" : ""); } if ( $wgRC2UDPInterwikiPrefix === true ) { |