smf: recover deleted topic

by prettyscripts on 2010-07-14 12:51:00

smfsql

important: you must have a backup of the database with deleted topic. if not, you might as well skip this post.

instruction here is based on smf v1.1.x and uses phpmyadmin. it's a free browser based mysql administration tool. but if you're a mysql expert or you're using a different database, you can still work out sql and commands.

restore backup

create a dummy database (make sure it's not the same name as the one used by your production forum!) and restore the backup database.

locate the missing topic

you need to know the topic id. if not, look for it via smf_messages table. you can look up subject and / or body columns. once found, note ID_TOPIC.

extract missing topic

assuming the topic id is 100.

from the backup database, click sql link and run the following sql's (one by one):

Code:

select * from smf_messages where ID_TOPIC = 100

Code:

select * from smf_topics where ID_TOPIC = 100

for each of the result, click export link from bottom of the result. do not click the export link on top of the page!

you're now at export page. from export box, select sql. uncheck 'save as file'. click go.

you should see various sql statements. just copy the insert statements.

now go to the production database. open sql window. paste the above insert statement.

check your forum

the topic should be back!

Tags: delete, phpmyadmin, retrieve, smf, topic

No feedback yet

Leave a comment


Your email address will not be revealed on this site.
PoorExcellent
note: all comments are moderated. do not spam and do not advertise. only comments relevant to the post will be published.
(Line breaks become <br />)
(For my next comment on this site)
(Allow users to contact me through a message form -- Your email will not be revealed!)