Restore the table 'topics'

Started by tek2000, October 09, 2008, 08:08:17 PM

Previous topic - Next topic

tek2000

Hello together,

i've backuped my SMF Forum to change my host. Now, a couple days later i just tried to restore my board an now i realize, that there ist no databse 'topics'. I've got all my Users, Messages, Categories, etc. but there is no table called 'topics'.

Is there any chance to restore this table with the help of the other tables?
I have to restore this, i would do it manually too, but how.

thanks a lot.

tek2000

Deprecated

I presume you mean the smf_topics table.

Two important tables are the smf_topics and smf_messages. The messages are the posts, and the topics have things like number of views and number of replies. Your smf_topics is SMF's key to getting at the smf_messages. Without the key there is no way to display the posts.

I don't know if in theory you could reconstruct the topics from the messages, but even if it is possible you would need some kind of custom software written. I mean that I don't see how it would be possible with just phpMyAdmin and SQL queries.

I think you're out of luck without that table and no easy way to reconstruct it. In essence you backup is only partial, and without the full backup it is unlikely you will get your forum running.

I hope you didn't fire your old host. Go back and do another backup. If you can't do that then I hope somebody will reply to this topic with better news than I can offer.

tek2000

Ok thats excatly what i thought...
So, without the smf_topic table backup is loss...

Well, at least i found a 8 month old backup, so i can restore something :-/
But if there is any hope for me: I'm waiting ;)

But Thank you for your quick answer deprecated!

Deprecated

Oh man! I'm sorry about that.

Dude, I backup my forums every 2-5 days! You backed it up only twice in 8 months?

The rule is that you never go longer than the amount of days you are willing to lose new topics and posts, PMs and new members joining.

It's a painful lesson to learn. In the future never go longer than one week!

SlammedDime

I back my database up every day, and I do a file backup once a week... can't be too cautious.

But yea, without that topics table, there isn't much you can do.
SlammedDime
Former Lead Customizer
BitBucket Projects
GeekStorage.com Hosting
                      My Mods
SimpleSEF
Ajax Quick Reply
Sitemap
more...
                     

Deprecated

Well between Slammed and me I think we've got the topic covered.

You are S.O.L. ... and don't ask if you don't know what that means. But I bet you know, particularly now.

I should backup more often. It's like flossing your teeth. You know you should do it every day.

tek2000

thank you, my friends. i definitly learned my lesson, but i find out a way to rebuild the smf_topic table. Its very complicatet, so i hope, somebody knows a better way to this.

so for understanding, what im going to do: i'v got the table smf_messages. there are no losses.

For the smf_topic, you need following:

`ID_TOPIC`-> Can be found in smf_messages
`isSticky`-> can be 0 all the time
`ID_BOARD`-> Can be found in smf_messages
`ID_FIRST_MSG`-> You have to search for it and put it in manually
`ID_LAST_MSG`-> You have to search for it and put it in manually
`ID_MEMBER_STARTED`-> Theres no effect, you can write 0 here too
`ID_MEMBER_UPDATED`-> Same thing here
`ID_POLL`-> Not important for the rebuild
`numReplies' -> You have to count that manually, else you get a wrong number of sites within the post
`numViews`-> 0 all the time. doesnt really matter
`locked -> 0, so its not locked

So, i thnik, thats it. the problem is, that there are about 300 topics with over thousands of posts. is there a chance to do this work more efficently?

thanks a lot

Deprecated

Yes, I think it is not impossible. There is however a question of practicality.

I have reconstructed a single topic before. Constructing one is just a matter of attention to detail. Get the numbers right and it works perfectly. But doing 300 of them? :(

I use SQL queries to count the number of posts. You go nuts trying to determine how many posts there are in multi-page threads. Find all the messages with the same topic number with a SQL query and phpMyAdmin will tell you how many items found, subtract one for the number of replies.

You can get member started from the first post and member updated from the last post.

It's looking more practical the more that I type and I'm sure a program could be written to do the job, but writing the database queries would be over my head at the present time, unless of course it was a paid job. (Not that I want the job, I meant that if it was in a commercial environment. I'm not interested in paid SMF work.)

I estimate it would take perhaps 15 minutes per topic to do it manually, once you got into it, so that's 75 hours of work, and it might be too liberal an estimate. It could take twice the time.

Perhaps there is somebody more advanced at database queries than I and maybe they might be for hire and do the job for you. My PHP is up to it, but not my database query skills. I agonize over every query I write. :)

You can do it manually if you want and I estimate 2-3 weeks work. (What a hard way to learn a lesson.) I hope my estimates are off. Maybe you could so it in a few days if I'm wrong, particularly if you don't sleep. ;)

SlammedDime

It would be possible to write a php script that runs through the messages table to reconstruct the topics table.  Let me see if I can do this.  Would you mind sending me your database to work with?  Zip it and put it on your site and send me a link to download it (anything over 5MB will be rejected by my mail provider).
SlammedDime
Former Lead Customizer
BitBucket Projects
GeekStorage.com Hosting
                      My Mods
SimpleSEF
Ajax Quick Reply
Sitemap
more...
                     

Deprecated

That would be great! I'm glad somebody can help this guy out! :)

tek2000

PM is on its way.

Thank you so much everybody!
This is really great!

SlammedDime

Ok, give this script a try.  It shouldn't make too much server load, but it does recreate the topics table in increments of 50.  It took only less than a minute to recreate your topics table on what you sent me.  Please please please backup your database first.

Open the file, and change the required information in the header (use the same information from SMF's Settings.php file)
Put the file on your server, it doesn't have to be in your SMF directory.  Navigate the file and let it work.  Once it has run, visit your admin panel in SMF and run the find and check for errors and fix any it may have.  Then visit your board and you should be good to go.
SlammedDime
Former Lead Customizer
BitBucket Projects
GeekStorage.com Hosting
                      My Mods
SimpleSEF
Ajax Quick Reply
Sitemap
more...
                     

Advertisement: