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

Orphan Threads and Posts?

Jaxel

Well-known member
#1
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?
 

Jaxel

Well-known member
#3
Okay, thanks... that takes care of orphan threads... but what about orphan posts?

Does deleting a thread also delete all attachments in a thread?
 

Jake Bunce

XenForo moderator
Staff member
#4
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.
 

Jaxel

Well-known member
#5
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.
I mean orphan posts... posts that are attached to a thread, that doesnt exist.
 

Jake Bunce

XenForo moderator
Staff member
#6
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.

Code:
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
 

Jaxel

Well-known member
#7
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.

Code:
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
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.
 

Jake Bunce

XenForo moderator
Staff member
#8
You can run this query on your database to check for orphaned posts:

Code:
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.