(bug 12953) prop=imageinfo should only set query-continue when there is only one title; trying to overwrite a previously set query-continue causes a fatal error

This commit is contained in:
Roan Kattouw 2008-02-07 12:21:48 +00:00
parent 8d57e2d678
commit a95cd777c7

View file

@ -81,11 +81,13 @@ class ApiQueryImageInfo extends ApiQueryBase {
// Now get the old revisions
// Get one more to facilitate query-continue functionality
$count = count($data);
$oldies = $img->getHistory($params['limit'] - count($data) + 1, $params['start'], $params['end']);
$oldies = $img->getHistory($params['limit'] - $count + 1, $params['start'], $params['end']);
foreach($oldies as $oldie) {
if(++$count > $params['limit']) {
// We've reached the extra one which shows that there are additional pages to be had. Stop here...
$this->setContinueEnumParameter('start', $oldie->getTimestamp());
// Only set a query-continue if there was only one title
if(count($pageIds[NS_IMAGE]) == 1)
$this->setContinueEnumParameter('start', $oldie->getTimestamp());
break;
}
$data[] = $this->getInfo($oldie);