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

XF 1.4 Soft Deleting via DB Query

Discussion in 'XenForo Questions and Support' started by Xanin, Nov 22, 2014.

  1. Xanin

    Xanin Member

    I recently migrated an ancient Active Forums site to Xenforo, by way of a manual conversion to phpBB. In the process I forgot to drop the soft-deleted posts from ActiveForums, and now I have roughly a thousand messages that should be deleted that aren't. Since I retained the IDs, can I simply run a query along the lines of this
    UPDATE xf_posts
    WHERE post_id IN (long list here)
    SET message_state = 'deleted';
    to set them all to a soft-deleted state, or are there other tables I would need to update as well?
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

  3. AndyB

    AndyB Well-Known Member

  4. Xanin

    Xanin Member

    Thank you, this is most helpful. since my posts aren't currently marked for moderation, I assume I can dispense with any of the moderated relating items, and narrow it down a bit for replies:

    INSERT INTO xf_deletion_log (content_type, content_id, delete_date, delete_user_id, delete_username, delete_reason)
    SELECT 'post',post_id,UNIX_TIMESTAMP(),1,'admin','manually moved from moderation to soft delete'
    FROM xf_post
    WHERE post_id IN(427091,427021,427034,427089,427090,427093. etc)
    UPDATE xf_post
    SET message_state = 'deleted'
    WHERE post_id IN(427091,427021,427034,427089,427090,427093. etc)
    But my post content isn't deleted in XenForo yet - that is what I am trying to rectify :/

Share This Page