allow find_images without limit

This commit is contained in:
Shish 2019-10-04 20:47:48 +01:00
parent cfa48deda1
commit 71c74e034b

View file

@ -148,8 +148,8 @@ class Image
$querylet->append(new Querylet(" ORDER BY ".(Image::$order_sql ?: "images.".$config->get_string("index_order")))); $querylet->append(new Querylet(" ORDER BY ".(Image::$order_sql ?: "images.".$config->get_string("index_order"))));
if ($limit!=null) { if ($limit!=null) {
$querylet->append(new Querylet(" LIMIT :limit ", ["limit" => $limit])); $querylet->append(new Querylet(" LIMIT :limit ", ["limit" => $limit]));
}
$querylet->append(new Querylet(" OFFSET :offset ", ["offset"=>$start])); $querylet->append(new Querylet(" OFFSET :offset ", ["offset"=>$start]));
}
#var_dump($querylet->sql); var_dump($querylet->variables); #var_dump($querylet->sql); var_dump($querylet->variables);
$result = $database->get_all_iterable($querylet->sql, $querylet->variables); $result = $database->get_all_iterable($querylet->sql, $querylet->variables);
} }
@ -165,7 +165,7 @@ class Image
* #param string[] $tags * #param string[] $tags
* #return Image[] * #return Image[]
*/ */
public static function find_images(int $start, int $limit, array $tags=[]): array public static function find_images(int $start, ?int $limit = null, array $tags=[]): array
{ {
$result = self::find_images_internal($start, $limit, $tags); $result = self::find_images_internal($start, $limit, $tags);