r80794 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r80793‎ | r80794 | r80795 >
Date:02:56, 23 January 2011
Author:brion
Status:reverted (Comments)
Tags:
Comment:
Fix for CodeReview on-demand AJAX diff loading; regression caused by refactoring in r80691.

This adds an is_null() check alongside the is_integer() check; CodeRepository::getDiff() currently returns null, not an integer result code, when no cached diff is available and we're preferring cached data only.
Modified paths:
  • /trunk/extensions/CodeReview/backend/CodeRepository.php (modified) (history)
  • /trunk/extensions/CodeReview/ui/CodeRevisionView.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/backend/CodeRepository.php
@@ -260,6 +260,9 @@
261261 * @param $useCache 'skipcache' to avoid caching
262262 * 'cached' to *only* fetch if cached
263263 * @return string|int The diff text on success, a DIFFRESULT_* constant on failure.
 264+ * @fixme Actually returns null if $useCache='cached' and there's no cached
 265+ * data. Either add a relevant constant or fix the comment above;
 266+ * caller in CodeRevisionView fixed by adding is_null check.
264267 */
265268 public function getDiff( $rev, $useCache = '' ) {
266269 global $wgMemc, $wgCodeReviewMaxDiffPaths;
Index: trunk/extensions/CodeReview/ui/CodeRevisionView.php
@@ -365,7 +365,7 @@
366366 $cache = '';
367367 }
368368 $diff = $this->mRepo->getDiff( $this->mRev->getId(), $cache );
369 - if ( is_integer($diff) && $deferDiffs ) {
 369+ if ( (is_null($diff) || is_integer($diff)) && $deferDiffs ) {
370370 // We'll try loading it by AJAX...
371371 return $this->stubDiffLoader();
372372 } elseif ( strlen( $diff ) > $wgCodeReviewMaxDiffSize ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r80822[CodeReview] Fixed accidental null value being returned from CodeRepository::...happydog17:17, 23 January 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r80691[CodeReview] Modified CodeRepository::getDiff() so it now returns a bit more ...happydog17:16, 21 January 2011

Comments

#Comment by HappyDog (talk | contribs)   17:19, 23 January 2011

Reverted in r80822, as proper fix implemented.

Status & tagging log