restore a single topic from backup

Get help with installation and running phpBB 3.2.x here. Please do not post bug reports, feature requests, or extension related questions here.
Post Reply
Registered User
Posts: 14
Joined: Thu Feb 12, 2009 1:41 pm

restore a single topic from backup

Post by seppo »

I accidentally deleted (hard delete) a non-spam topic, while performing deletion of tons of spam topics. I did take a backup, but since then there might have been new posts, so it is not best to restore whole backup. Is there a way to migrate (after installing the backup to different folder or domain etc), or export/import one topic?
User avatar
Registered User
Posts: 18868
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK

Re: restore a single topic from backup

Post by david63 »

Because of the way that the tables are interlinked it would be very difficult to import just one topic.

Your options are to restore the database, restore the database to your local test server and then manually copy & paste, or just leave the board without the deleted topic.
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored
User avatar
Support Team Member
Support Team Member
Posts: 51817
Joined: Thu Nov 02, 2006 12:21 am
Location: The U.P.
Name: Steve

Re: restore a single topic from backup

Post by stevemaury »

I would import the old database backup into a new, blank database and do this query on the new database in phpMyAdmin ( Executing SQL Queries in phpMyAdmin ):

Code: Select all

SELECT * from phpbb_posts WHERE topic_id = X;
SELECT * FROM phpbb_topics WHERE topic_id = X;
SELECT * FROM phpbb_topics_posted WHERE topic_id = X;
SELECT * FROM phpbb_topics_watch WHERE topic_id = X;
SELECT * FROM phpbb_topics_track WHERE topic_id = X
If phpbb_is not your table prefix, change accordingly. X is the topic_id of the topic you want to import.

Then export the results of that query. Open the sql file in a text editor and delete the 5 CREATE TABLE portions of the backup or add IF NOT EXISTS right after CREATE TABLE so all 5 read CREATE TABLE IF NOT EXISTS

Disable the board and then import the SQL file into your existing live database. Backup all five involved tables of your existing live database before importing.

I tested this and it seems to work. It is worth a try and if it doesn't work, just restore the backed up tables. You disable the board to prevent any posting that changes the backed up tables in case you have to restore them.
For REALLY good and VERY inexpensive hosting CLICK HERE

I can stop all your spam. I can upgrade or update your Board. PM or email me. (Paid support)
Post Reply

Return to “[3.2.x] Support Forum”