(bug 12953) prop=imageinfo should only set query-continue when there is only one...
authorRoan Kattouw <catrope@users.mediawiki.org>
Thu, 7 Feb 2008 12:21:48 +0000 (12:21 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Thu, 7 Feb 2008 12:21:48 +0000 (12:21 +0000)
includes/api/ApiQueryImageInfo.php

index 0e214db..fb11c12 100644 (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);