r41871 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r41870‎ | r41871 | r41872 >
Date:23:03, 8 October 2008
Author:aaron
Status:old
Tags:
Comment:
Add purge link
Modified paths:
  • /trunk/extensions/CodeReview/CodeRepository.php (modified) (history)
  • /trunk/extensions/CodeReview/CodeReview.i18n.php (modified) (history)
  • /trunk/extensions/CodeReview/CodeRevisionView.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/CodeRepository.php
@@ -147,7 +147,7 @@
148148 return CodeRevision::newFromRow( $row );
149149 }
150150
151 - function getDiff( $rev ) {
 151+ function getDiff( $rev, $skipCache = '' ) {
152152 global $wgMemc;
153153
154154 $rev1 = $rev - 1;
@@ -159,7 +159,11 @@
160160 }
161161
162162 $key = wfMemcKey( 'svn', md5( $this->mPath ), 'diff', $rev1, $rev2 );
163 - $data = $wgMemc->get( $key );
 163+ if( $skipCache === 'skipcache' ) {
 164+ $data = NULL;
 165+ } else {
 166+ $data = $wgMemc->get( $key );
 167+ }
164168
165169 if( !$data ) {
166170 $svn = SubversionAdaptor::newFromRepo( $this->mPath );
Index: trunk/extensions/CodeReview/CodeReview.i18n.php
@@ -57,6 +57,7 @@
5858 'code-rev-comment-preview' => 'Preview',
5959 'code-rev-diff' => 'Diff',
6060 'code-rev-diff-link' => 'diff',
 61+ 'code-rev-purge-link' => 'purge',
6162 'code-status-new' => 'new',
6263 'code-status-fixme' => 'fixme',
6364 'code-status-resolved' => 'resolved',
Index: trunk/extensions/CodeReview/CodeRevisionView.php
@@ -11,6 +11,7 @@
1212 $this->mPreviewText = false;
1313 $this->mReplyTarget = $replyTarget ?
1414 (int)$replyTarget : $wgRequest->getIntOrNull( 'wpParent' );
 15+ $this->mSkipCache = ($wgRequest->getVal( 'action' ) == 'purge');
1516 }
1617
1718 function execute(){
@@ -62,13 +63,12 @@
6364 $diffHtml = $this->formatDiff();
6465 if( $diffHtml ) {
6566 $html .=
66 - "<h2>" . wfMsgHtml( 'code-rev-diff' ) . "</h2>" .
67 - "<div class='mw-codereview-diff'>" .
68 - $diffHtml .
69 - "</div>\n";
 67+ "<h2>" . wfMsgHtml( 'code-rev-diff' ) .
 68+ ' <small>[' . $wgUser->getSkin()->makeLinkObj( $special,
 69+ wfMsg('code-rev-purge-link'), 'action=purge' ) . ']</small></h2>' .
 70+ "<div class='mw-codereview-diff'>" . $diffHtml . "</div>\n";
7071 }
71 - $html .=
72 - "<h2 id='code-comments'>". wfMsgHtml( 'code-comments' ) ."</h2>\n" .
 72+ $html .= "<h2 id='code-comments'>". wfMsgHtml( 'code-comments' ) ."</h2>\n" .
7373 $this->formatComments();
7474
7575 if( $this->mReplyTarget ) {
@@ -228,7 +228,7 @@
229229 }
230230
231231 function formatDiff() {
232 - $diff = $this->mRepo->getDiff( $this->mRev->getId() );
 232+ $diff = $this->mRepo->getDiff( $this->mRev->getId(), $this->mSkipCache ? 'skipcache' : '' );
233233 if( !$diff ) {
234234 return false;
235235 }

Status & tagging log