Index: trunk/extensions/CodeReview/CodeRevisionView.php |
— | — | @@ -225,8 +225,27 @@ |
226 | 226 | } |
227 | 227 | |
228 | 228 | 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 ) { |
231 | 250 | // We'll try loading it by AJAX... |
232 | 251 | return $this->stubDiffLoader(); |
233 | 252 | } |