http://www.mediawiki.org/wiki/Special:Code/MediaWiki/84714
Revision: 84714
Author: reedy
Date: 2011-03-24 21:41:04 +0000 (Thu, 24 Mar 2011)
Log Message:
-----------
Followup r84711
Cache $codeCommentLinkerWiki too, reuse the html one in another place
Modified Paths:
--------------
trunk/extensions/CodeReview/ui/CodeReleaseNotes.php
trunk/extensions/CodeReview/ui/CodeRevisionView.php
trunk/extensions/CodeReview/ui/CodeView.php
Modified: trunk/extensions/CodeReview/ui/CodeReleaseNotes.php
===================================================================
--- trunk/extensions/CodeReview/ui/CodeReleaseNotes.php 2011-03-24 21:35:14 UTC
(rev 84713)
+++ trunk/extensions/CodeReview/ui/CodeReleaseNotes.php 2011-03-24 21:41:04 UTC
(rev 84714)
@@ -47,7 +47,6 @@
protected function showReleaseNotes() {
global $wgOut;
- $linker = new CodeCommentLinkerHtml( $this->mRepo );
$dbr = wfGetDB( DB_SLAVE );
$where = array();
if ( $this->mEndRev ) {
@@ -85,8 +84,8 @@
$summary = str_replace( "\n", "<br />",
$summary ); // Newlines -> <br />
$wgOut->addHTML( "<li>" );
$wgOut->addHTML(
- $linker->link( $summary ) . "
<i>(" . htmlspecialchars( $row->cr_author ) .
- ', ' . $linker->link(
"r{$row->cr_id}" ) . ")</i>"
+
$this->codeCommentLinkerHtml->link( $summary ) . " <i>(" . htmlspecialchars(
$row->cr_author ) .
+ ', ' .
$this->codeCommentLinkerHtml->link( "r{$row->cr_id}" ) . ")</i>"
);
$wgOut->addHTML( "</li>\n" );
}
Modified: trunk/extensions/CodeReview/ui/CodeRevisionView.php
===================================================================
--- trunk/extensions/CodeReview/ui/CodeRevisionView.php 2011-03-24 21:35:14 UTC
(rev 84713)
+++ trunk/extensions/CodeReview/ui/CodeRevisionView.php 2011-03-24 21:41:04 UTC
(rev 84714)
@@ -661,7 +661,6 @@
*/
protected function formatComment( $comment, $replyForm = '' ) {
global $wgOut, $wgLang;
- $linker = new CodeCommentLinkerWiki( $this->mRepo );
if ( $comment->id === 0 ) {
$linkId = 'cpreview';
@@ -687,7 +686,7 @@
$this->commentReplyLink( $comment->id ) .
'</div>' .
'<div class="mw-codereview-comment-text">' .
- $wgOut->parse( $linker->link( $comment->text ) ) .
+ $wgOut->parse( $this->codeCommentLinkerWiki->link(
$comment->text ) ) .
'</div>' .
$replyForm .
'</div>';
Modified: trunk/extensions/CodeReview/ui/CodeView.php
===================================================================
--- trunk/extensions/CodeReview/ui/CodeView.php 2011-03-24 21:35:14 UTC (rev
84713)
+++ trunk/extensions/CodeReview/ui/CodeView.php 2011-03-24 21:41:04 UTC (rev
84714)
@@ -17,8 +17,13 @@
/**
* @var CodeCommentLinkerHtml
*/
- var $codeCommentLinker;
+ var $codeCommentLinkerHtml;
+ /**
+ * @var CodeCommentLinkerWiki
+ */
+ var $codeCommentLinkerWiki;
+
function __construct( $repo ) {
$this->mRepo = ( $repo instanceof CodeRepository )
? $repo
@@ -27,7 +32,8 @@
global $wgUser;
$this->skin = $wgUser->getSkin();
- $this->codeCommentLinker = new CodeCommentLinkerHtml( $repo );
+ $this->codeCommentLinkerHtml = new CodeCommentLinkerHtml(
$this->mRepo );
+ $this->codeCommentLinkerWiki = new CodeCommentLinkerWiki(
$this->mRepo );
}
function validPost( $permission ) {
@@ -51,7 +57,7 @@
function formatMessage( $text ) {
$text = nl2br( htmlspecialchars( $text ) );
- return $this->codeCommentLinker->link( $text );
+ return $this->codeCommentLinkerHtml->link( $text );
}
function messageFragment( $value ) {
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs