how can I import data to SMF using sql command?

Started by surfman, August 07, 2005, 12:59:53 PM

Previous topic - Next topic

surfman

I have some xml files at my hand. I may convert them to any sql script. what I want to know is, is that possible to use sql script to import those data?

What I want to do is to create a category that has several forums and hold those data inside. those forums will be read-only. no one may post new thread or reply.

is that possible? Thanks.

[Unknown]

It should be, but not just with one SQL query - quite likely not with just a couple, either.

I assume you have some way of saying "this post belongs to this topic", etc. in your data, right?  Are you using ids?  If so, are you using numeric ids increasing by time (as SMF uses)?

If so, it makes things a lot easier.

-[Unknown]

surfman

Thanks. Those data files are exported in XML format from Infopop 1 year ago. each post has its topic id, topic text, forum name, post time, author and master topic that the post belongs to. To keep everything simple, I don't want to use username/userid, What I want to keep are:

1) each forum name
2) each thread and replies belong to the thread under one forum
3) post time of each post
4) author, just keep a plain text name, no any related account feature required.

that's it.

Please let me know the easiest way. Thanks.

[Unknown]

Infopop... UBB.classic, UBB.threads, or UBB.x (Eve)?  I believe a converter may be available for the second two, and one for the exported data is already available as far as I know for the first, from another party.

So, the easiest way would be to not go to too much trouble ;).  It may be, however, that you are using an incompatible version...

-[Unknown]

surfman

#4
it was eve. I exported them (posts) in XML format in early 2004. Please let me know if you have anything may help me out. Thanks.

Modified: each XML is more than 100M. it is a realy big file.

[Unknown]

Grudge is currently on vacation, but when he gets back I expect he'll take a look at this topic.  He was the one who worked with the previous converter for Eve, unless I'm mistaken.

-[Unknown]

Grudge

Hi surfman,

I haven't actually written a converter for Eve (Only UBB.threads, although one does exist for UBB.Classic made by someone else). That said I can try find the time to make one up. The only problem is I'd need to see the xml files to be able to write it. Maybe you could either send me a link to where I could download them, or otherwise try make them relatively small (i.e just give me a little example data - not 100MB) and email them?

Grudge
I'm only a half geek really...

[Unknown]

Quote from: Grudge on August 21, 2005, 04:23:13 PM
Hi surfman,

I haven't actually written a converter for Eve (Only UBB.threads, although one does exist for UBB.Classic made by someone else). That said I can try find the time to make one up. The only problem is I'd need to see the xml files to be able to write it. Maybe you could either send me a link to where I could download them, or otherwise try make them relatively small (i.e just give me a little example data - not 100MB) and email them?

I thought someone had sent you their data for it too?  I must be remembering wrong.

-[Unknown]

Grudge

I'm only a half geek really...

Grudge

Righty, this has taken me all morning to get to work but I think it does the basics. The XML files don't really contain information on the user accounts so at the moment the converter doesn't register the members. I could probably get it to register the members with a generic password that they would need to reset.

The converter only converts the forums (Of which you only had one in this file), topics and messages. Some of the formatting is a bit off - I believe due to the way eve probably exported things. As most of it is chinese I've not really been able to tell if it worked - but on my test install it managed to do all 3,500 topics.

Instructions:
1) Upload the two attached files to your SMF directory - make sure you are running SMF 1.1 Beta 3(or 4) and that there is nothing in the forum as everything will get wiped.
2) Upload your xml data file to the SMF directory, and rename it to ubb_exported.xml
3) Run ubbxml_to_smf.php from the command line, and hit return.

The converter should pause several times during the install, but will finish eventually (Probably take about 5 minutes). If you have more than one xml file you will have to run the converter once for each file (I didn't write it with multi file support but I can if necessary). If you do run it more than once you *must* make sure you don't select "purge all data" on any subsequent execution.

Anyway, try it out and see how it goes. This was a new thing for me to try so was quite interesting to code!

Grudge
I'm only a half geek really...

surfman

#10
thanks, i will try it later to see if it's fine. Thank you very much.

by the way, the mentioned command line means under SSH?

Grudge

I'm only a half geek really...

Advertisement: