r84714 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84713‎ | r84714 | r84715 >
Date:21:41, 24 March 2011
Author:reedy
Status:ok
Tags:
Comment:
Followup r84711

Cache $codeCommentLinkerWiki too, reuse the html one in another place
Modified paths:
  • /trunk/extensions/CodeReview/ui/CodeReleaseNotes.php (modified) (history)
  • /trunk/extensions/CodeReview/ui/CodeRevisionView.php (modified) (history)
  • /trunk/extensions/CodeReview/ui/CodeView.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/ui/CodeView.php
@@ -17,8 +17,13 @@
1818 /**
1919 * @var CodeCommentLinkerHtml
2020 */
21 - var $codeCommentLinker;
 21+ var $codeCommentLinkerHtml;
2222
 23+ /**
 24+ * @var CodeCommentLinkerWiki
 25+ */
 26+ var $codeCommentLinkerWiki;
 27+
2328 function __construct( $repo ) {
2429 $this->mRepo = ( $repo instanceof CodeRepository )
2530 ? $repo
@@ -27,7 +32,8 @@
2833 global $wgUser;
2934 $this->skin = $wgUser->getSkin();
3035
31 - $this->codeCommentLinker = new CodeCommentLinkerHtml( $repo );
 36+ $this->codeCommentLinkerHtml = new CodeCommentLinkerHtml( $this->mRepo );
 37+ $this->codeCommentLinkerWiki = new CodeCommentLinkerWiki( $this->mRepo );
3238 }
3339
3440 function validPost( $permission ) {
@@ -51,7 +57,7 @@
5258
5359 function formatMessage( $text ) {
5460 $text = nl2br( htmlspecialchars( $text ) );
55 - return $this->codeCommentLinker->link( $text );
 61+ return $this->codeCommentLinkerHtml->link( $text );
5662 }
5763
5864 function messageFragment( $value ) {
Index: trunk/extensions/CodeReview/ui/CodeRevisionView.php
@@ -661,7 +661,6 @@
662662 */
663663 protected function formatComment( $comment, $replyForm = '' ) {
664664 global $wgOut, $wgLang;
665 - $linker = new CodeCommentLinkerWiki( $this->mRepo );
666665
667666 if ( $comment->id === 0 ) {
668667 $linkId = 'cpreview';
@@ -687,7 +686,7 @@
688687 $this->commentReplyLink( $comment->id ) .
689688 '</div>' .
690689 '<div class="mw-codereview-comment-text">' .
691 - $wgOut->parse( $linker->link( $comment->text ) ) .
 690+ $wgOut->parse( $this->codeCommentLinkerWiki->link( $comment->text ) ) .
692691 '</div>' .
693692 $replyForm .
694693 '</div>';
Index: trunk/extensions/CodeReview/ui/CodeReleaseNotes.php
@@ -47,7 +47,6 @@
4848
4949 protected function showReleaseNotes() {
5050 global $wgOut;
51 - $linker = new CodeCommentLinkerHtml( $this->mRepo );
5251 $dbr = wfGetDB( DB_SLAVE );
5352 $where = array();
5453 if ( $this->mEndRev ) {
@@ -85,8 +84,8 @@
8685 $summary = str_replace( "\n", "<br />", $summary ); // Newlines -> <br />
8786 $wgOut->addHTML( "<li>" );
8887 $wgOut->addHTML(
89 - $linker->link( $summary ) . " <i>(" . htmlspecialchars( $row->cr_author ) .
90 - ', ' . $linker->link( "r{$row->cr_id}" ) . ")</i>"
 88+ $this->codeCommentLinkerHtml->link( $summary ) . " <i>(" . htmlspecialchars( $row->cr_author ) .
 89+ ', ' . $this->codeCommentLinkerHtml->link( "r{$row->cr_id}" ) . ")</i>"
9190 );
9291 $wgOut->addHTML( "</li>\n" );
9392 }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r84711Cache creation of instance of linkerreedy21:29, 24 March 2011

Status & tagging log