avoid passing an array as a database parameter, fixes #820

This commit is contained in:
Shish 2024-01-04 18:40:02 +00:00
parent 53152bf9f0
commit d8986159fe

View file

@ -88,6 +88,8 @@ class TagEditCloud extends Extension
if (count($relevant_tags) == 0) {
return null;
}
$relevant_tag_ids = implode(',', array_map(fn ($t) => Tag::get_or_create_id($t), $relevant_tags));
$tag_data = $database->get_all(
"
SELECT t2.tag AS tag, COUNT(image_id) AS count, FLOOR(LN(LN(COUNT(image_id) - :tag_min1 + 1)+1)*150)/200 AS scaled
@ -95,11 +97,11 @@ class TagEditCloud extends Extension
JOIN image_tags it2 USING(image_id)
JOIN tags t1 ON it1.tag_id = t1.id
JOIN tags t2 ON it2.tag_id = t2.id
WHERE t1.count >= :tag_min2 AND t1.tag IN(:relevant_tags)
WHERE t1.count >= :tag_min2 AND t1.tag_id IN ($relevant_tag_ids)
GROUP BY t2.tag
ORDER BY count DESC
LIMIT :limit",
["tag_min1" => $tags_min, "tag_min2" => $tags_min, "limit" => $max_count, "relevant_tags" => $relevant_tags]
["tag_min1" => $tags_min, "tag_min2" => $tags_min, "limit" => $max_count]
);
break;
/** @noinspection PhpMissingBreakStatementInspection */