Lack of interest Content attach_count rebuild


Well-known member
Wouldn't it be better to use XenForo_Model_Attachment::countAttachments inside datawriters:.associateAttachments and after attachment deletion to rebuild the counter, instead of calling +1 / -1 queries (*). This would deliver the real values.
I've just seen on another board with inconsistent attachment_count values (there are several problems because of the wrong attach_count value) It seems that there's at least 1 buggy addon available, which is causing this bug.

I mean the -1 operation inside the attachment handler
			UPDATE xf_conversation_message
			SET attach_count = IF(attach_count > 0, attach_count - 1, 0)
			WHERE message_id = ?
		', $attachment['content_id']);[/php]