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

Orphan Threads and Posts?

Discussion in 'Troubleshooting and Problems' started by Jaxel, Dec 29, 2010.

  1. Jaxel

    Jaxel Well-Known Member

    I had a forum with posts in it... I deleted that forum. The threads and posts from that forum are still in the database. How do I get access to those threads/posts so that I can either view them or delete them?
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

  3. Jaxel

    Jaxel Well-Known Member

    Okay, thanks... that takes care of orphan threads... but what about orphan posts?

    Does deleting a thread also delete all attachments in a thread?
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    The posts are attached to the threads.

    Yes, attachments are deleted when you delete a thread. Note that the attachments are not deleted immediately. Rather they are processed by the Hourly Clean Up cron.
  5. Jaxel

    Jaxel Well-Known Member

    I mean orphan posts... posts that are attached to a thread, that doesnt exist.
  6. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Are you having a problem with orphaned posts in the database? Do you know how that happened?

    You can run a similar query to associate posts with different threads.

    UPDATE xf_post
    SET thread_id = 4
    WHERE thread_id = 2
    Replace the id numbers as before, except this time it's the thread_id and not the node_id.

    Then you will need to run this:

    Admin CP -> Tools -> Rebuild Caches -> Rebuild Thread Information
  7. Jaxel

    Jaxel Well-Known Member

    Running that query would be pretty much impossible. I have thousands of threads and posts, it would be impossible search each and every one of them to find out if they are orphans without some sort of script to do it automatically.

    I dont know if I have any orphan problems... but I know VB4 is ****, and I wouldn't be surprised if I do.
  8. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    You can run this query on your database to check for orphaned posts:

    SELECT p.post_id, p.thread_id
    FROM xf_post AS p
    LEFT JOIN xf_thread AS t ON (t.thread_id = p.thread_id)
    WHERE t.thread_id IS NULL
    If the query returns any records then there are orphaned posts.
    maszd, Valter, Brogan and 1 other person like this.

Share This Page