Some questions on vbulletin import script (groups, likes, attachments)


(Louis Rossouw) #1

I’m importing a community forum from vbulletin. And I can’t wait to get it done, because I want to start using discourse pronto.

I’ve managed to get the script running and it can import: users, groups, categories, topics (i.e. first posts) and then failed. Because I gave it only read access to my vb db (to be safe). The backup / restore feature is also invaluable in testing this stuff because it’s so easy to go back to an empty forum.

At this stage, before I run it again I have some questions on this:

  • How should I do the user <-> group mappings? I see it takes the primary group in some way but I don’t see this on the imported forum anywhere. Plus other groups? I guess I’d be able to do the SQL from the mysql side, but how do I add the groups on discourse from the script? Thinking about it the easiest would be to do it “by hand” after import using bulk add user to group funciton.
  • Our forum uses the DragonByte Tech: Advanced Post Thanks / Like plugin. I guess I’d be able to figure out who liked/thanked which post from the MySQL database, but again, how do I import said like to discourse. Probably after posts have been imported I need to loop through all the likes/thanks in my database and like the corresponding post on discourse? (Can’t wait for the dislike button to disappear…).
  • I haven’t got to attachments yet, but our forum uses attachments that are stored in the DB it seems. Will this be handled by the script or do I need to make changes?
  • I see posts with vb code are not being formatted at present. I need to run something after import I believe?

Thanks!


(Kane York) #2

You’ll need to create records in the post_actions table.

Here’s the columns you need to know:

id  serial primary key
post_id  integer fkey posts
user_id  integer fkey users
post_action_type_id  integer ; like = 2
deleted_at  timestamp null
created_at  timestamp
updated_at  timestamp
deleted_by_id  integer null, fkey users

Importing from Vanilla, need assistance for Likes
(Louis Rossouw) #3

I figured out a neat way to fix this. On the vb forum go to the attachment and switch storage to file based. It will ask for a folder and export all the attachments to that folder. When it is done, it will ask you to finalise this. At this point if you say no you have a folder with all the attachments but the forum is left untouched with attachments in the db.


(Louis Rossouw) #4

I see the following remaining formatting issues on my transferred forum. That is after the post clean-up scripts ran:

Lists tags aren’t fixed

[LIST]
[*]item 1
[*]item 2
[*]item 3
[/LIST]

I guess I should just remove the tags and the brackets round the * and add a space and it should be formatted right. Any ideas how? I can update the import script regex I guess? Looking for some regex genius help.

COLOR tags

[COLOR=#212121][FONT=Helvetica Neue]blah blah[/FONT][/COLOR]
[COLOR=#212121][FONT=Helvetica Neue]blah blah[/FONT][/COLOR]

This seems to come from posts that were made on the old forum by posting formatted text into them.

I guess best would be to just remove the tags? Again need a regex expert I guess?

Is this a bug because this is BBCode? Should this not be picked up? I didn’t for example need to use backtick to quote the above.


(Louis Rossouw) #5

Found a bug & PR on phpBB importer. This seems to also apply to vBulletin also.


(Louis Rossouw) #6

I´ve updated the post_action table and imported our old likes. These are shown in queries, but not in the interface.
How do I refresh the interface?
Answer: rake user_actions:rebuild


(Kane York) #7

Oh right, the importer should have been calling PostAction.act I think instead of inserting rows.

My bad!


(Louis Rossouw) #8

Yes I wasn’t going to write the import code. Just did it manually from database to database. Then ran the rake. My ruby is bad.