Lack of interest Content attach_count rebuild

This suggestion has been closed automatically because it did not receive enough votes over an extended period of time. If you wish to see this, please search for an open suggestion and, if you don't find any, post a new one.

xf_phantom

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
Code:
$db->query('
			UPDATE xf_conversation_message
			SET attach_count = IF(attach_count > 0, attach_count - 1, 0)
			WHERE message_id = ?
		', $attachment['content_id']);[/php]
 
Upvote 0
This suggestion has been closed. Votes are no longer accepted.
Top Bottom