No announcement yet.

Accidentally deleted an entire category!

  • Filter
  • Time
  • Show
Clear All
new posts

  • Accidentally deleted an entire category!

    So, the title says it all, I accidentally deleted an entire category. I'm past the point of cold sweat and all, I'm currently at the point of trying to figure out what's the best way to restore it. I do have a backup that's luckily just 24hrs old, BUT, that backup contains the entire database with all threads and posts. Suppose I can manually filter out only the entries that belong to that category, if I import them back to the DB as an SQL statement, will the deleted threads re-appear in the forum somewhere? Has anyone ever restored an accidentally deleted category before?

  • #2
    Stop your forum now and restore your most recent backup.

    Explain to members that you made a mistake, or lie and say there was a hardware failure. You really have no other choice.

    Glad you have a recent backup.


    • #3
      DISCLAIMER: I could be completely wrong so please test this with care

      If Im right, the topics will still be in the database (a while since I used vb3.8). Therefore you could create a new forum, get the forum id, then change the forum id for all those threads in the database that are orphaned and place them within your new forum. From there you can then sort out where they should really be.

      Like I said above, test this on a dev environment first though if you are going to attempt it.
      Husky Owners Forum - For all Siberian Husky Owners


      • #4
        Thank you both for the prompt replies. Restoring the entire DB was the easy way to go but I'll try to restore just that category. The threads are no longer in the database but I'm comfortable retrieving them selectively from the backup. I'll keep you posted, thanks guys.


        • #5
          Deep down inside I didn't really really believe that I would make it, but guess what? I DID! Ha haaaa!!!!

          Here's what I did, in case others find themselves in the same deep s**t hole:

          1. I created a new category (forum) in the live installation and noted down the forum ID.
          2. I loaded my backup on a local phpmyadmin installation, and filtered all threads that belonged to the deleted forum ID (table: vbthread).
          3. Then I changed the old ID to the new one and exported those rows (file 1) from the backup.
          4. I re-filtered vbthread to display only the threadid field of all entries that had the new forumid, and noted down all the thread ID's that belonged to the deleted category
          5. I crafted an SQL statement to filter all posts from vbpost table that were posted under any of the thread ID's I noted above (it took a long series of OR statements) and exported the resulting rows (file 2) from the backup.
          6. I imported the two files into the live database and rebuilt counters.

          ta-daaa!!!! Everything was there! Well, whatever had been posted between the backup time and the deletion had actually been lost, but I can live with that; luckily that wasn't a very busy section.

          Thank you guys!


          widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.