r27904 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r27903‎ | r27904 | r27905 >
Date:20:37, 27 November 2007
Author:amidaniel
Status:old
Tags:
Comment:
API: difftoprev fails when 'rvprop=ids' is not specified. Sort of gross way to fix the problem, but it works.
Modified paths:
  • /trunk/phase3/includes/api/ApiQueryRevisions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryRevisions.php
@@ -258,10 +258,15 @@
259259 $previousRevID = $revid;
260260 $oldText = $newText;
261261 }
262 - // Now that $this->diffArr is filled with diffprev elements, add them to the result
263 - foreach($data['query']['pages'][$pageID]['revisions'] as &$rev)
264 - if(isset($diffArr[$rev['revid']]))
265 - $rev['difftoprev'] = $diffArr[$rev['revid']];
 262+
 263+ # Populate the query result with the contents of $diffArr.
 264+ $knownrevs = array_keys($diffArr);
 265+ $i = count($knownrevs) - 1;
 266+ foreach($data['query']['pages'][$pageID]['revisions'] as &$rev) {
 267+ if ( $i >= 0 && isset ( $diffArr[$knownrevs[$i]] ) )
 268+ $rev['difftoprev'] = $diffArr[$knownrevs[$i]];
 269+ $i --;
 270+ }
266271 }
267272
268273 // Ensure that all revisions are shown as '<rev>' elements

Status & tagging log