Index: trunk/phase3/includes/api/ApiQueryRevisions.php |
— | — | @@ -253,19 +253,21 @@ |
254 | 254 | $diff = new Diff($oldText, $newText); |
255 | 255 | $r['from'] = $previousRevID; |
256 | 256 | ApiResult::setContent($r, $wgContLang->unsegmentForDiff($this->formatter->format($diff))); |
257 | | - $diffArr[$revid] = $r; |
| 257 | + $this->diffArr[$revid] = $r; |
258 | 258 | |
259 | 259 | $previousRevID = $revid; |
260 | 260 | $oldText = $newText; |
261 | 261 | } |
262 | 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 --; |
| 263 | + if ( $this->diffArr ) { |
| 264 | + # Populate the query result with the contents of $this->diffArr. |
| 265 | + $knownrevs = array_keys($this->diffArr); |
| 266 | + $i = count($knownrevs) - 1; |
| 267 | + foreach($data['query']['pages'][$pageID]['revisions'] as &$rev) { |
| 268 | + if ( $i >= 0 && isset ( $this->diffArr[$knownrevs[$i]] ) ) |
| 269 | + $rev['difftoprev'] = $this->diffArr[$knownrevs[$i]]; |
| 270 | + $i --; |
| 271 | + } |
270 | 272 | } |
271 | 273 | } |
272 | 274 | |