From: Aaron Schulz Date: Tue, 21 Feb 2012 23:39:14 +0000 (+0000) Subject: Separate out an IRC actionText field for RecentChange. The two are currently the... X-Git-Tag: 1.31.0-rc.0~24580 X-Git-Url: http://git.cyclocoop.org/%24self?a=commitdiff_plain;h=6846f3c3a8cd44e7d61cb975988c1ccbff879694;p=lhc%2Fweb%2Fwiklou.git Separate out an IRC actionText field for RecentChange. The two are currently the same but that will change soon. --- diff --git a/includes/RecentChange.php b/includes/RecentChange.php index 67bc5307c6..bb5580833e 100644 --- a/includes/RecentChange.php +++ b/includes/RecentChange.php @@ -503,10 +503,11 @@ class RecentChange { * @param $logComment * @param $params * @param $newId int + * @param $actionCommentIRC string * @return bool */ - 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, $actionCommentIRC='' ) { global $wgLogRestrictions; # Don't add private logs to RC! @@ -514,7 +515,7 @@ class RecentChange { return false; } $rc = self::newLogEntry( $timestamp, $title, $user, $actionComment, $ip, $type, $action, - $target, $logComment, $params, $newId ); + $target, $logComment, $params, $newId, $actionCommentIRC ); $rc->save(); return true; } @@ -531,10 +532,11 @@ class RecentChange { * @param $logComment * @param $params * @param $newId int + * @param $actionCommentIRC string * @return RecentChange */ - public static function newLogEntry( $timestamp, &$title, &$user, $actionComment, $ip='', - $type, $action, $target, $logComment, $params, $newId=0 ) { + public static function newLogEntry( $timestamp, &$title, &$user, $actionComment, $ip, + $type, $action, $target, $logComment, $params, $newId=0, $actionCommentIRC='' ) { global $wgRequest; if( !$ip ) { $ip = $wgRequest->getIP(); @@ -575,6 +577,7 @@ class RecentChange { 'prefixedDBkey' => $title->getPrefixedDBkey(), 'lastTimestamp' => 0, 'actionComment' => $actionComment, // the comment appended to the action, passed from LogPage + 'actionCommentIRC' => $actionCommentIRC ); return $rc; } @@ -712,7 +715,7 @@ class RecentChange { if ( $this->mAttribs['rc_type'] == RC_LOG ) { $targetText = $this->getTitle()->getPrefixedText(); - $comment = self::cleanupForIRC( str_replace( "[[$targetText]]", "[[\00302$targetText\00310]]", $this->mExtra['actionComment'] ) ); + $comment = self::cleanupForIRC( str_replace( "[[$targetText]]", "[[\00302$targetText\00310]]", $this->mExtra['actionCommentIRC'] ) ); $flag = $this->mAttribs['rc_log_action']; } else { $comment = self::cleanupForIRC( $this->mAttribs['rc_comment'] ); diff --git a/includes/logging/LogPage.php b/includes/logging/LogPage.php index 193ff5235c..53c9b237fa 100644 --- a/includes/logging/LogPage.php +++ b/includes/logging/LogPage.php @@ -100,7 +100,7 @@ class LogPage { RecentChange::notifyLog( $now, $titleObj, $this->doer, $this->getRcComment(), '', $this->type, $this->action, $this->target, $this->comment, - $this->params, $newId + $this->params, $newId, $this->getRcCommentIRC() ); } elseif( $this->sendToUDP ) { # Don't send private logs to UDP @@ -114,7 +114,7 @@ class LogPage { $rc = RecentChange::newLogEntry( $now, $titleObj, $this->doer, $this->getRcComment(), '', $this->type, $this->action, $this->target, $this->comment, - $this->params, $newId + $this->params, $newId, $this->getRcCommentIRC() ); $rc->notifyRC2UDP(); } @@ -140,6 +140,25 @@ class LogPage { return $rcComment; } + /** + * Get the RC comment from the last addEntry() call for IRC + * + * @return string + */ + public function getRcCommentIRC() { + $rcComment = $this->ircActionText; + + if( $this->comment != '' ) { + if ( $rcComment == '' ) { + $rcComment = $this->comment; + } else { + $rcComment .= wfMsgForContent( 'colon-separator' ) . $this->comment; + } + } + + return $rcComment; + } + /** * Get the comment from the last addEntry() call */ @@ -459,6 +478,7 @@ class LogPage { $formatter->setContext( $context ); $this->actionText = $formatter->getPlainActionText(); + $this->ircActionText = $formatter->getPlainActionText(); return $this->saveContent(); }