Limiting image history listings to 500 for now. A hard-coded limit sucks, but an...
authorRoan Kattouw <catrope@users.mediawiki.org>
Tue, 15 Jan 2008 21:09:44 +0000 (21:09 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Tue, 15 Jan 2008 21:09:44 +0000 (21:09 +0000)
includes/api/ApiQueryImageInfo.php

index 7e7abeb..778c5c6 100644 (file)
@@ -68,7 +68,13 @@ class ApiQueryImageInfo extends ApiQueryBase {
                                        $repository = $img->getRepoName();
 
                                        $isCur = true;
+                                       $count = 0;
                                        while($line = $img->nextHistoryLine()) { // assignment
+                                               # FIXME: Limiting to 500 because it's unlimited right now
+                                               #        500+ image histories are scarce, but this has DoS potential
+                                               #        FileRepo.php should be fixed
+                                               if($count++ == 500)
+                                                       break;
                                                $row = get_object_vars( $line );
                                                $vals = array();
                                                $prefix = $isCur ? 'img' : 'oi';