r112062 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112061‎ | r112062 | r112063 >
Date:23:39, 21 February 2012
Author:aaron
Status:ok
Tags:
Comment:
Separate out an IRC actionText field for RecentChange. The two are currently the same but that will change soon.
Modified paths:
  • /trunk/phase3/includes/RecentChange.php (modified) (history)
  • /trunk/phase3/includes/logging/LogPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/RecentChange.php
@@ -503,10 +503,11 @@
504504 * @param $logComment
505505 * @param $params
506506 * @param $newId int
 507+ * @param $actionCommentIRC string
507508 * @return bool
508509 */
509 - public static function notifyLog( $timestamp, &$title, &$user, $actionComment, $ip='', $type,
510 - $action, $target, $logComment, $params, $newId=0 )
 510+ public static function notifyLog( $timestamp, &$title, &$user, $actionComment, $ip, $type,
 511+ $action, $target, $logComment, $params, $newId=0, $actionCommentIRC='' )
511512 {
512513 global $wgLogRestrictions;
513514 # Don't add private logs to RC!
@@ -514,7 +515,7 @@
515516 return false;
516517 }
517518 $rc = self::newLogEntry( $timestamp, $title, $user, $actionComment, $ip, $type, $action,
518 - $target, $logComment, $params, $newId );
 519+ $target, $logComment, $params, $newId, $actionCommentIRC );
519520 $rc->save();
520521 return true;
521522 }
@@ -531,10 +532,11 @@
532533 * @param $logComment
533534 * @param $params
534535 * @param $newId int
 536+ * @param $actionCommentIRC string
535537 * @return RecentChange
536538 */
537 - public static function newLogEntry( $timestamp, &$title, &$user, $actionComment, $ip='',
538 - $type, $action, $target, $logComment, $params, $newId=0 ) {
 539+ public static function newLogEntry( $timestamp, &$title, &$user, $actionComment, $ip,
 540+ $type, $action, $target, $logComment, $params, $newId=0, $actionCommentIRC='' ) {
539541 global $wgRequest;
540542 if( !$ip ) {
541543 $ip = $wgRequest->getIP();
@@ -575,6 +577,7 @@
576578 'prefixedDBkey' => $title->getPrefixedDBkey(),
577579 'lastTimestamp' => 0,
578580 'actionComment' => $actionComment, // the comment appended to the action, passed from LogPage
 581+ 'actionCommentIRC' => $actionCommentIRC
579582 );
580583 return $rc;
581584 }
@@ -712,7 +715,7 @@
713716
714717 if ( $this->mAttribs['rc_type'] == RC_LOG ) {
715718 $targetText = $this->getTitle()->getPrefixedText();
716 - $comment = self::cleanupForIRC( str_replace( "[[$targetText]]", "[[\00302$targetText\00310]]", $this->mExtra['actionComment'] ) );
 719+ $comment = self::cleanupForIRC( str_replace( "[[$targetText]]", "[[\00302$targetText\00310]]", $this->mExtra['actionCommentIRC'] ) );
717720 $flag = $this->mAttribs['rc_log_action'];
718721 } else {
719722 $comment = self::cleanupForIRC( $this->mAttribs['rc_comment'] );
Index: trunk/phase3/includes/logging/LogPage.php
@@ -100,7 +100,7 @@
101101 RecentChange::notifyLog(
102102 $now, $titleObj, $this->doer, $this->getRcComment(), '',
103103 $this->type, $this->action, $this->target, $this->comment,
104 - $this->params, $newId
 104+ $this->params, $newId, $this->getRcCommentIRC()
105105 );
106106 } elseif( $this->sendToUDP ) {
107107 # Don't send private logs to UDP
@@ -114,7 +114,7 @@
115115 $rc = RecentChange::newLogEntry(
116116 $now, $titleObj, $this->doer, $this->getRcComment(), '',
117117 $this->type, $this->action, $this->target, $this->comment,
118 - $this->params, $newId
 118+ $this->params, $newId, $this->getRcCommentIRC()
119119 );
120120 $rc->notifyRC2UDP();
121121 }
@@ -141,6 +141,25 @@
142142 }
143143
144144 /**
 145+ * Get the RC comment from the last addEntry() call for IRC
 146+ *
 147+ * @return string
 148+ */
 149+ public function getRcCommentIRC() {
 150+ $rcComment = $this->ircActionText;
 151+
 152+ if( $this->comment != '' ) {
 153+ if ( $rcComment == '' ) {
 154+ $rcComment = $this->comment;
 155+ } else {
 156+ $rcComment .= wfMsgForContent( 'colon-separator' ) . $this->comment;
 157+ }
 158+ }
 159+
 160+ return $rcComment;
 161+ }
 162+
 163+ /**
145164 * Get the comment from the last addEntry() call
146165 */
147166 public function getComment() {
@@ -459,6 +478,7 @@
460479 $formatter->setContext( $context );
461480
462481 $this->actionText = $formatter->getPlainActionText();
 482+ $this->ircActionText = $formatter->getPlainActionText();
463483
464484 return $this->saveContent();
465485 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r112063r112062: swap the getPlainActionText() for IRC with new getIRCActionText() fu...aaron23:42, 21 February 2012
r112065r112062: updated LogEntry publish() function tooaaron23:51, 21 February 2012
r112073MFT r112045, r112046, r112049, r112061, r112062, r112063, r112065, r112066, r...reedy00:54, 22 February 2012

Status & tagging log