r42008 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r42007‎ | r42008 | r42009 >
Date:00:47, 13 October 2008
Author:brion
Status:old
Tags:
Comment:
If the API is off, deferred diff loads won't work, so don't try. :)
Modified paths:
  • /trunk/extensions/CodeReview/CodeRevisionView.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/CodeRevisionView.php
@@ -225,8 +225,27 @@
226226 }
227227
228228 function formatDiff() {
229 - $diff = $this->mRepo->getDiff( $this->mRev->getId(), $this->mSkipCache ? 'skipcache' : 'cached' );
230 - if( !$diff ) {
 229+ global $wgEnableAPI;
 230+
 231+ // Asynchronous diff loads will require the API
 232+ // And JS in the client, but tough shit eh? ;)
 233+ $deferDiffs = $wgEnableAPI;
 234+
 235+ if( $this->mSkipCache ) {
 236+ // We're purging the cache on purpose, probably
 237+ // because the cached data was corrupt.
 238+ $cache = 'skipcache';
 239+ } elseif( $deferDiffs ) {
 240+ // If data is already cached, we'll take it now;
 241+ // otherwise defer the load to an AJAX request.
 242+ // This lets the page be manipulable even if the
 243+ // SVN connection is slow or uncooperative.
 244+ $cache = 'cached';
 245+ } else {
 246+ $cache = '';
 247+ }
 248+ $diff = $this->mRepo->getDiff( $this->mRev->getId(), $cache );
 249+ if( !$diff && $deferDiffs ) {
231250 // We'll try loading it by AJAX...
232251 return $this->stubDiffLoader();
233252 }

Status & tagging log