vBulletin import fails on import_topics


We are currently testing migration from vBulletin to Discourse and we’re moving our site which has over a decade of posts.

All users and groups have been migrated, but when the script hits “import_topics”, this error fires:

importing topics...
vbulletin.rb:213:in `block (2 levels) in import_topics': undefined local variable or method `topic' for #<ImportScripts::VBulletin:0x007f6b33cc1e88> (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:213:in `map'
from vbulletin.rb:213:in `block in import_topics'
from /var/www/discourse/script/import_scripts/base.rb:676:in `block in batches'
from /var/www/discourse/script/import_scripts/base.rb:675:in `loop'
from /var/www/discourse/script/import_scripts/base.rb:675:in `batches'
from vbulletin.rb:201:in `import_topics'
from vbulletin.rb:33:in `execute'
from /var/www/discourse/script/import_scripts/base.rb:45:in `perform'
from vbulletin.rb:563:in `<main>'

I’m not super familiar with Ruby, so I’m not even sure where it gets the ‘topic’ variable from as it does not seem to be defined anywhere but referenced in several places.

Thanks for your help :smile:

1 Like

Looks like the importer needs some love. :wink:

Change line 213 in script/import_scripts/vbulletin.rb to:

next if all_records_exist? :posts, topics.map {|t| "thread-#{t["threadid"]}" }