manually pull parts out of 57f2a50fb7

This commit is contained in:
Shish 2019-07-07 11:16:47 +01:00
parent f8a08a7aae
commit 4136b1bb6b

View File

@ -525,23 +525,20 @@ class TagList extends Extension
}
$tag_id_list = join(', ', $tag_id_array);
if (count($tag_id_array) > 5) {
if (count($tag_id_array) > 5 || count($tag_id_array) == 0) {
return;
}
if ($tags_ok) {
$query = "
SELECT t2.tag AS tag, COUNT(it2.image_id) AS calc_count
FROM
image_tags AS it1,
image_tags AS it2,
tags AS t1,
tags AS t2
FROM image_tags AS it1 -- Got other images with the same tags
-- Get the tags from those images, except those the same as the starting tags
INNER JOIN image_tags AS it2 ON it1.image_id=it2.image_id AND it2.tag_id NOT IN($tag_id_list)
-- And filter out anything starting with tagme
INNER JOIN tags AS t2 ON it2.tag_id = t2.id AND t2.tag NOT LIKE 'tagme%'
WHERE
t1.id IN($tag_id_list)
AND it1.image_id=it2.image_id
AND it1.tag_id = t1.id
AND it2.tag_id = t2.id
it1.tag_id IN($tag_id_list)
GROUP BY t2.tag
ORDER BY calc_count
DESC LIMIT :limit