vBulletin Migration Issue

(Magnetidog) #1


I have successfully configured Discourse on a Digitalocean droplet and then setup the importer for vBulletin using the various topics on the the forum. The importer is now connecting correctly to the database (installed on the same server and coming from a vBulletin 4 installation). Anyhow, a few seconds after the process has started, I get this error:

discourse@discourse:/var/www/discourse/script/import_scripts$ RAILS_ENV=production ruby vbulletin.rb
loading existing groups...
loading existing users...
loading existing categories...
loading existing posts...
loading existing topics...

importing groups...
        6 / 25 ( 24.0%)  Failed to create group id 7 Moderators: ["Name has already been taken"]
       25 / 25 (100.0%)  
importing users
/var/www/discourse/script/import_scripts/base.rb:202:in `escape_string': wrong argument type Fixnum (expected String) (TypeError)
importing groups...
        6 / 25 ( 24.0%)  Failed to create group id 7 Moderators: ["Name has already been taken"]
       25 / 25 (100.0%)  
importing users
/var/www/discourse/script/import_scripts/base.rb:202:in `escape_string': wrong argument type Fixnum (expected String) (TypeError)
	from /var/www/discourse/script/import_scripts/base.rb:202:in `block in all_records_exist?'
	from /var/www/discourse/script/import_scripts/base.rb:202:in `map'
	from /var/www/discourse/script/import_scripts/base.rb:202:in `all_records_exist?'
	from vbulletin.rb:75:in `block in import_users'
	from /var/www/discourse/script/import_scripts/base.rb:675:in `block in batches'
	from /var/www/discourse/script/import_scripts/base.rb:674:in `loop'
	from /var/www/discourse/script/import_scripts/base.rb:674:in `batches'
	from vbulletin.rb:64:in `import_users'
	from vbulletin.rb:32:in `execute'
	from /var/www/discourse/script/import_scripts/base.rb:45:in `perform'
	from vbulletin.rb:564:in `<main>'

Is there anything I could do to figure out what is going on here?


(Gerhard Schlager) #2

Try changing line 202 in /var/www/discourse/script/import_scripts/base.rb to and see if that helps:

import_id_clause = import_ids.map{|id| "('#{PG::Connection.escape_string(id.to_s)}')"}.join(",")

(Mike Nielsen) #3

We’re in the process of testing a migration from vBulletin to Discourse as well, and we’ve gotten stuck at the exact place. I’m not sure if it’s because the “moderators” group is colliding with the built in group in Discourse.

I’ve tried changing line 202 as suggested, but seems to have resulted in ruby seg faulting instead.

(Gerhard Schlager) #4

Yeah, that’s a known problem with the mysql2 gem.
In the meantime, try changing line 558 in script/import_scripts/vbulletin.rb:

@client.query(sql, cache_rows: true)

(Mike Nielsen) #5

That seemed to have done the trick.

I might have double fixed it, as I also renamed the vBulletin group “Moderators” to “moderators” (lower cap).

Thanks a lot for your help :slight_smile:

(Magnetidog) #6

This is great, thanks for the help. I had tried already the to_s way and I
had the seg fault error as well.

I am trying again in a few hours as I am out of the office now, and I will
report back if there is any problem.

Thanks for the help!!!

(Magnetidog) #7

So, this worked beautifully. After the import reaches the category import and has imported them, anyhow, I am hitting another error. I wonder if anybody else has the same issue. I am currently trying to debug it without going through the entire import again, but if you are getting the same issue, please let me know :wink:

This is the error I am getting.

importing children categories...
       30 / 30 (100.0%)  
importing topics...
vbulletin.rb:214:in `block (2 levels) in import_topics': undefined local variable or method `topic' for #<ImportScripts::VBulletin:0x007fde4904b468> (NameError)
	from /var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rack-mini-profiler-0.9.7/lib/patches/db/mysql2.rb:6:in `each'
	from /var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rack-mini-profiler-0.9.7/lib/patches/db/mysql2.rb:6:in `each'
	from vbulletin.rb:214:in `map'
	from vbulletin.rb:214:in `block in import_topics'
	from /var/www/discourse/script/import_scripts/base.rb:678:in `block in batches'
	from /var/www/discourse/script/import_scripts/base.rb:677:in `loop'
	from /var/www/discourse/script/import_scripts/base.rb:677:in `batches'
	from vbulletin.rb:202:in `import_topics'
	from vbulletin.rb:34:in `execute'
	from /var/www/discourse/script/import_scripts/base.rb:45:in `perform'
	from vbulletin.rb:564:in `<main>'

(Magnetidog) #8

The issue is this line here (line 214, more or less as I placed a couple of puts for debugging along the way):

topics.map {|t| “thread-#{topic[“threadid”]}” }

which I have changed to

topics.map {|t| “thread-#{t[“threadid”]}” }

But I wonder why I am getting this error if nobody else is. Will keep you posted.

Edit:I am past the thread import and it seems to have worked fine. This is a bit of a large import so I will add to this if I encounter more issues.

(Gerhard Schlager) #9

Someone else noticed the same problem. :wink:

(Magnetidog) #10

Ahah great, thanks!

The import worked fine after that. The only other gotcha was the need to have custom images (non attachments) hosted into the database.

But now I will need to redo the import again and generate the proper rewrite ruleset for the client. Pretty sure I will be posting again soon :smile:

Thanks for the help!