- Affected version
- 2.1.2
Code:
SELECT `xf_mg_media_item`.*, `xf_mg_album_Album_1`.*, `xf_mg_category_Category_2`.*, `xf_user_User_3`.*, `xf_attachment_Attachment_4`.*, `xf_attachment_data_Data_5`.*, `xf_permission_cache_content_Permissions_6`.*
FROM `xf_mg_media_item`
LEFT JOIN `xf_mg_album` AS `xf_mg_album_Album_1` ON (`xf_mg_album_Album_1`.`album_id` = `xf_mg_media_item`.`album_id`)
LEFT JOIN `xf_mg_category` AS `xf_mg_category_Category_2` ON (`xf_mg_category_Category_2`.`category_id` = `xf_mg_media_item`.`category_id`)
LEFT JOIN `xf_user` AS `xf_user_User_3` ON (`xf_user_User_3`.`user_id` = `xf_mg_media_item`.`user_id`)
LEFT JOIN `xf_attachment` AS `xf_attachment_Attachment_4` ON (`xf_attachment_Attachment_4`.`content_type` = 'xfmg_media' AND `xf_attachment_Attachment_4`.`content_id` = `xf_mg_media_item`.`media_id`)
LEFT JOIN `xf_attachment_data` AS `xf_attachment_data_Data_5` ON (`xf_attachment_data_Data_5`.`data_id` = `xf_attachment_Attachment_4`.`data_id`)
LEFT JOIN `xf_permission_cache_content` AS `xf_permission_cache_content_Permissions_6` ON (`xf_permission_cache_content_Permissions_6`.`content_type` = 'xfmg_category' AND `xf_permission_cache_content_Permissions_6`.`content_id` = `xf_mg_category_Category_2`.`category_id` AND `xf_permission_cache_content_Permissions_6`.`permission_combination_id` = 'X')
WHERE (`xf_mg_media_item`.`last_comment_date` > 0) AND (`xf_mg_media_item`.`media_state` <> 'deleted') AND (`xf_mg_media_item`.`last_comment_date` > Y)
ORDER BY `xf_mg_media_item`.`last_comment_date` DESC, `xf_mg_media_item`.`media_id` DESC
LIMIT 200;
We do get a bunch of those queries logged every day.
As we do not even have comments (but over 400K images) this is kinda wasteful.