Index: trunk/phase3/includes/api/ApiQueryRevisions.php |
— | — | @@ -258,10 +258,15 @@ |
259 | 259 | $previousRevID = $revid; |
260 | 260 | $oldText = $newText; |
261 | 261 | } |
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 | + } |
266 | 271 | } |
267 | 272 | |
268 | 273 | // Ensure that all revisions are shown as '<rev>' elements |