r70660 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70659‎ | r70660 | r70661 >
Date:05:06, 8 August 2010
Author:soxred93
Status:resolved (Comments)
Tags:
Comment:
(bug 24107) CodeReview now sends UDP messages when an update is made. Patch by John Du Hart
Modified paths:
  • /trunk/extensions/CodeReview/CodeReview.php (modified) (history)
  • /trunk/extensions/CodeReview/backend/CodeRevision.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/CodeReview.php
@@ -155,6 +155,13 @@
156156 */
157157 $wgCodeReviewDeferredPaths = array();
158158
 159+/**
 160+ * UDP comment and status changes notification
 161+ */
 162+$wgCRUDPAddress = false;
 163+$wgCRUDPPort = false;
 164+$wgCRUDPPrefix = '';
 165+
159166 # Schema changes
160167 $wgHooks['LoadExtensionSchemaUpdates'][] = 'efCodeReviewSchemaUpdates';
161168
Index: trunk/extensions/CodeReview/backend/CodeRevision.php
@@ -180,6 +180,9 @@
181181 __METHOD__
182182 );
183183 }
 184+
 185+ $this->sendStatusToUDP( $status, $oldStatus );
 186+
184187 return true;
185188 }
186189
@@ -441,6 +444,8 @@
442445 }
443446 }
444447
 448+ $this->sendCommentToUDP( $commentId, $text, $url );
 449+
445450 return $commentId;
446451 }
447452
@@ -780,4 +785,40 @@
781786 return false;
782787 }
783788 }
 789+
 790+ protected function sendCommentToUDP( $commentId, $text, $url = null ) {
 791+ global $wgCodeReviewUDPAddress, $wgCodeReviewUDPPort, $wgCodeReviewUDPPrefix, $wgLang, $wgUser;
 792+
 793+ if( $wgCodeReviewUDPAddress ) {
 794+ if( is_null( $url ) ) {
 795+ $title = SpecialPage::getTitleFor( 'Code', $this->mRepo->getName() . '/' . $this->mId );
 796+ $title->setFragment( "#c{$commentId}" );
 797+ $url = $title->getFullUrl();
 798+ }
 799+
 800+ $line = wfMsg( 'code-rev-message' ) . " \00314(" . $this->mRepo->getName() .
 801+ ")\003 \0037" . $this->getIdString() . "\003 \00303" . RecentChange::cleanupForIRC( $wgUser->getName() ) .
 802+ "\003: \00310" . RecentChange::cleanupForIRC( $wgLang->truncate( $text, 100 ) ) . "\003 " . $url;
 803+
 804+ RecentChange::sendToUDP( $line, $wgCodeReviewUDPAddress, $wgCodeReviewUDPPrefix, $wgCodeReviewUDPPort );
 805+ }
 806+ }
 807+
 808+ protected function sendStatusToUDP( $status, $oldStatus ) {
 809+ global $wgCodeReviewUDPAddress, $wgCodeReviewUDPPort, $wgCodeReviewUDPPrefix, $wgUser;
 810+
 811+ if( $wgCodeReviewUDPAddress ) {
 812+ $title = SpecialPage::getTitleFor( 'Code', $this->mRepo->getName() . '/' . $this->getId() );
 813+ $url = $title->getFullUrl();
 814+
 815+ $line = wfMsg( 'code-rev-status' ) . " \00314(" . $this->mRepo->getName() .
 816+ ")\00303 " . RecentChange::cleanupForIRC( $wgUser->getName() ) . "\003 " .
 817+ /* Remove three apostrophes as they are intended for the parser */
 818+ str_replace( "'''", '', wfMsg( 'code-change-status', "\0037" . $this->getIdString() . "\003" ) ) .
 819+ ": \00315" . wfMsg( 'code-status-' . $oldStatus ) . "\003 -> \00310" .
 820+ wfMsg( 'code-status-' . $status ) . "\003 " . $url;
 821+
 822+ RecentChange::sendToUDP( $line, $wgCodeReviewUDPAddress, $wgCodeReviewUDPPrefix, $wgCodeReviewUDPPort );
 823+ }
 824+ }
784825 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r74958Follow up r70660 : fix UDP default settings ($wgCR.* -> $wgCodeReview.*)hashar18:35, 18 October 2010

Comments

#Comment by Hashar (talk | contribs)   18:36, 18 October 2010

Settings in CodeReview.php were not consistent with code !

$wgCRUDPAddress = false;
$wgCRUDPPort = false;
$wgCRUDPPrefix = ;

Fixed in r74958

Status & tagging log