Migrate a bbPress WordPress plugin forum to Discourse

It sounds like it.

And my vbulletin import script, which does handle non-linked attachments, doesn’t look for them in that table, so you’ll need some custom code to deal with that, even after I get around to submitting a PR with my script.

EDIT: and it also means that I think that even if they were linked in-post they still wouldn’t work, since they aren’t where the script expects them in the database.

1 个赞

Good news! I don’t know exactly how the import script handles it but it does! After making the files accessible to the import container and digging a bit in the script I found that it works. The only problem I had was that the file name which I tested it on contained an ä and thus some weird encoding shit prevented the script from finding the file actually. After fixing the filename the import worked and the attachment appeared at the post!

Thanks a lot for all the tips! :beers:

1 个赞

Awesome! Glad the magic worked for you! (Oh! I and I see now that I was looking at the vBulletin script and not bbPress, hence my confusion. That explains why I couldn’t find the table!)

1 个赞

Hi
I got an error after launching the IMPORT bundle exec command:

Using unicorn 5.5.1
Using webmock 3.7.6
Using webpush 1.0.0
Using yaml-lint 0.0.10
Bundle complete! 130 Gemfile dependencies, 214 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
Traceback (most recent call last):
        31: from scripts/import_scripts/bbpress.rb:4:in `<main>'
        30: from scripts/import_scripts/bbpress.rb:4:in `require'
        29: from /var/discourse/scripts/import_scripts/base.rb:16:in `<top (required)>'
        28: from /var/discourse/scripts/import_scripts/base.rb:16:in `require_relative'
        27: from /var/discourse/config/environment.rb:7:in `<top (required)>'
        26: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.1/lib/rails/railtie.rb:190:in `method_missing'
        25: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.1/lib/rails/railtie.rb:190:in `public_send'
        24: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.1/lib/rails/application.rb:363:in `initialize!'
        23: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.1/lib/rails/initializable.rb:60:in `run_initializers'
        22: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each'
        21: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each'
        20: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component'
        19: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:347:in `call'
        18: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:347:in `each'
        17: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:349:in `block in each_strongly_connected_component'
        16: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from'
        15: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
        14: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:228:in `block in tsort_each'
        13: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.1/lib/rails/initializable.rb:61:in `block in run_initializers'
        12: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.1/lib/rails/initializable.rb:32:in `run'
        11: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.1/lib/rails/initializable.rb:32:in `instance_exec'
        10: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.1/lib/rails/application/bootstrap.rb:73:in `block in <module:Bootstrap>'
         9: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/lazy_load_hooks.rb:51:in `run_load_hooks'
         8: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/lazy_load_hooks.rb:51:in `each'
         7: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/lazy_load_hooks.rb:52:in `block in run_load_hooks'
         6: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/lazy_load_hooks.rb:67:in `execute_hook'
         5: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/lazy_load_hooks.rb:62:in `with_execution_control'
         4: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/lazy_load_hooks.rb:69:in `block in execute_hook'
         3: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/ember-rails-0.18.5/lib/ember/rails/engine.rb:19:in `block in <class:Engine>'
         2: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/active_support.rb:59:in `load_missing_constant'
         1: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/active_support.rb:16:in `allow_bootsnap_retry'
/home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/active_support.rb:60:in `block in load_missing_constant': uninitialized constant Sprockets::Engines (NameError)
        32: from scripts/import_scripts/bbpress.rb:4:in `<main>'
        31: from scripts/import_scripts/bbpress.rb:4:in `require'
        30: from /var/discourse/scripts/import_scripts/base.rb:16:in `<top (required)>'
        29: from /var/discourse/scripts/import_scripts/base.rb:16:in `require_relative'
        28: from /var/discourse/config/environment.rb:7:in `<top (required)>'
        27: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.1/lib/rails/railtie.rb:190:in `method_missing'
        26: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.1/lib/rails/railtie.rb:190:in `public_send'
        25: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.1/lib/rails/application.rb:363:in `initialize!'
        24: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.1/lib/rails/initializable.rb:60:in `run_initializers'
        23: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each'
        22: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each'
        21: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component'
        20: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:347:in `call'
        19: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:347:in `each'
        18: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:349:in `block in each_strongly_connected_component'
        17: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from'
        16: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
        15: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tsort.rb:228:in `block in tsort_each'
        14: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.1/lib/rails/initializable.rb:61:in `block in run_initializers'
        13: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.1/lib/rails/initializable.rb:32:in `run'
        12: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.1/lib/rails/initializable.rb:32:in `instance_exec'
        11: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.1/lib/rails/application/bootstrap.rb:73:in `block in <module:Bootstrap>'
        10: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/lazy_load_hooks.rb:51:in `run_load_hooks'
         9: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/lazy_load_hooks.rb:51:in `each'
         8: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/lazy_load_hooks.rb:52:in `block in run_load_hooks'
         7: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/lazy_load_hooks.rb:67:in `execute_hook'
         6: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/lazy_load_hooks.rb:62:in `with_execution_control'
         5: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-6.0.1/lib/active_support/lazy_load_hooks.rb:69:in `block in execute_hook'
         4: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/ember-rails-0.18.5/lib/ember/rails/engine.rb:19:in `block in <class:Engine>'
         3: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/active_support.rb:58:in `load_missing_constant'
         2: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/active_support.rb:79:in `rescue in load_missing_constant'
         1: from /home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/active_support.rb:8:in `without_bootsnap_cache'
/home/kenaddams42/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/active_support.rb:79:in `block in load_missing_constant': uninitialized constant Sprockets::Engines (NameError)
root@sd-114000:/var/discourse# ~

Any idea please ?
Thank you :wink:

Thanks for this tutorial, @vinothkannans!

I’m stuck modifying bbpress.rb

After running sudo nano script/import_scripts/bbpress.rb it opens the file editor, but when I tray and save, it says there’s no such file or directory:

image

It’s a totally fresh install.

Many thanks,

Jake

In the above guide, I used /var/discourse directory to install the Discourse development environment. If you installed it in a different location then make sure to cd to that directory (‘~/discourse’ in most cases) instead of the above before running the sudo nano script/import_scripts/bbpress.rb command.

3 个赞

Hi,

I don’t see “script” path in /var/discourse folder.

  • I tried from DigitalOcean’s new Discourse Marketplace fresh instance.
  • I tried from Discourse Docker official install.

This is what /var/discourse/scripts/ looks like:


Best regards

That’s right.

You’ll need to set up a development environment or follow instructions in other import topics about how you might run the import script inside of a production container.

Finally found How to use the bbpress import script - or any other import script with mysql dependency - developers - Discourse Meta for missing part.

Thanks

1 个赞

@vinothkannans 我正在尝试从 WPForo 迁移到 Discourse,但脚本/代码超出了我的能力范围。您(或其他人)能帮我解决这个问题吗?谢谢。

您最好发到 #marketplace。有很多人会关注那个类别,他们可以提供帮助。

2 个赞

我们也有 Migration 类别,用于特定的迁移问题。:+1:

3 个赞

当我按照指南操作并运行导入脚本时,我遇到了以下错误。我按照这些说明安装了 discourse。

myuser@tmp-discourse:~/discourse$ IMPORT=1 bundle &amp;&amp; IMPORT=1 bundle exec ruby script/import_scripts/bbpress.rb

[!] 解析 `Gemfile` 时出错:您不能为同一个 gem 指定不同的版本要求。
您指定了:sqlite3 (~&gt; 1.3, &gt;= 1.3.13) 和 sqlite3 (&gt;= 0)。Bundler 无法继续。

 #  来自 /home/myuser/discourse/Gemfile:251
 #  -------------------------------------------
 #  group :generic_import, optional: true do
 &gt;    gem "sqlite3"
 #    gem "redcarpet"
 #  -------------------------------------------

通过在 Gemfile 中更改此设置,我使其正常工作

# 注意:在导入模式下,sqlite 的版本可能非常重要,因此我们将其固定为特定版本
#gem "sqlite3", "~> 1.3", ">= 1.3.13"
  gem "sqlite3"

我还需要在我的 Ubuntu 22.04 LTS 安装中安装此软件包

sudo apt install freetds-dev