将 bbPress WordPress 插件论坛迁移到 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:

感谢这个教程,@vinothkannans

我在修改 bbpress.rb 时遇到了问题。

运行 sudo nano script/import_scripts/bbpress.rb 后,文件编辑器打开了,但当我尝试保存时,系统提示“没有这样的文件或目录”:

这是一个全新的安装。

非常感谢,

Jake

在上述指南中,我使用了 /var/discourse 目录来安装 Discourse 开发环境。如果您将其安装在其他位置,请确保在运行 sudo nano script/import_scripts/bbpress.rb 命令之前,先 cd 切换到该目录(大多数情况下为 '~/discourse'),而不是使用上述路径。

3 个赞

您好,

我在 /var/discourse 文件夹中没有看到“script”路径。

  • 我尝试了 DigitalOcean 新发布的 Discourse 市场镜像全新实例。
  • 我也尝试了 Discourse Docker 官方安装方式。

以下是 /var/discourse/scripts/ 目录的内容:


此致,敬礼

没错。

您需要设置一个开发环境,或者参考其他关于导入的主题中的说明,了解如何在生产容器内运行导入脚本。

终于找到了缺失部分的解决方案:Use an import script that requires MySQL

谢谢

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