1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Lack of Interest Content attach_count rebuild

Discussion in 'Closed Suggestions' started by xf_phantom, Mar 10, 2014.

  1. xf_phantom

    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
    			UPDATE xf_conversation_message
    			SET attach_count = IF(attach_count > 0, attach_count - 1, 0)
    			WHERE message_id = ?
    		', $attachment['content_id']);[/php]

Share This Page