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

XF 1.4 Restoring a single thread from a backup

Discussion in 'Troubleshooting and Problems' started by rys, Jul 19, 2015.

  1. rys

    rys Member

    I accidentally hard deleted a thread in my forum earlier today. I have a backup of the database from a few hours before. It is possible to restore the thread and its posts?

    If so, is it as simple as restoring the inserts into xf_thread and xf_post, or are there more tables involved?

    Thanks in advance!
  2. Mike

    Mike XenForo Developer Staff Member

    There really isn't a way to do this. There are potentially a large number of tables involved, including some denormalized data in places like the user table.
  3. Mr Lucky

    Mr Lucky Well-Known Member

    Well there is a rather clunky way to do it with Addons but I would not want to try it with a long thread

    You need to repost everything manually using the Addons login as user and change date
  4. rys

    rys Member

    Thanks for the clarification it's a nightmare. I manually copied and pasted from a server running the backup copy of the DB, into the live site. It broke attribution for the posts (nearly 400 of them) but at least the post contents are back.
  5. Mr Lucky

    Mr Lucky Well-Known Member

    Would it not work to run the backup database on a copy/test installation then create a new forum and move that thread to it, delete all threads and forums except that thread and forum, delete all users not in that thread and then do an import?

    (With forum closed and backed up of course)
    Last edited: Jul 21, 2015
  6. AndyB

    AndyB Well-Known Member

    What do you mean by "attribution" ?
  7. vij

    vij Active Member

    I was able to restore a thread recently with a crude method.

    Do this in your older database. Go to phpMyAdmin
    1. Select the table xf_thread (xf is my prefix)
    2. Find the thread_id of the thread you deleted.
    3. Delete all threads except the thread you want. Run this: DELETE * FROM xf_thread where thread_id !=your thread number
    4. Do the same for xf_posts. DELETE * FROM xf_post where thread_id !=your thread number
    5. Delete all tables except xf_thread and xf_post
    6. Now export the database and import into your current database
    rys likes this.
  8. rys

    rys Member

    All of the posts came from me, since I just copied and pasted the contents.
  9. Mr Lucky

    Mr Lucky Well-Known Member

    If you have a lot of time on your hands, there is this addon: Change Author
    rys and AndyB like this.
  10. AndyB

    AndyB Well-Known Member

    You will want to use the following two add-ons to change the author and time of the thread posts:

    Change Author

    Change Date
    rys likes this.
  11. rys

    rys Member

    Ah, excellent, thanks a lot guys! I'll use them both to clear the thread up soon.

Share This Page