将 vBulletin 4 论坛迁移到 Discourse

I know this is a bit of an old topic, but I’ve just completed a comparably sized vb4 migration and am missing a LOT of image attachments, somewhere on the order of 75% of them I’d wager. They are not tombstoned, and all the threads have been rebaked.

Has anyone else dealt with this? How should I go about recovering those images?

Did you see errors when you did the import?

1 个赞

Yes, quite a few ‘Attachment file doesn’t exist’ errors with some ‘Couldn’t find attachment record for post.id=xxx, import_id=xxx’ sprinkled in.

The thing that has me scratching my head is that these are posts that I know have intact attachments, and that those attachments are in the ATTACHMENT_DIR global directory. The threads with missing images are missing ALL the associated images, which seems… not random.

I’m at a loss to find any common factor among the threads/posts with lost images either.

Those messages were your clue that something was amiss. All you can do is diagnose the problem an run the import again.

Every import is a snowflake. I’ve don’t dozens of them. It’s rare that one just works. If you’d like help: Discourse Migration – Literate Computing, LLC

2 个赞

我想通过转换我们庞大的 VBulletin 数据库来尝试 Discourse,因此正在试用这个脚本。

它已成功导入用户和群组,但在导入子分类时已失败两次。

   正在导入顶级分类...
        7 / 7 (100.0%)  [902 项/分钟]   n]
正在导入子分类...
Traceback (most recent call last):
        5: from script/import_scripts/vbulletin.rb:942:in `<main>'
        4: from /home/peterb/discourse/script/import_scripts/base.rb:47:in `perform'
        3: from script/import_scripts/vbulletin.rb:84:in `execute'
        2: from script/import_scripts/vbulletin.rb:287:in `import_categories'
        1: from script/import_scripts/vbulletin.rb:287:in `each'
script/import_scripts/vbulletin.rb:289:in `block in import_categories': undefined method `[]' for nil:NilClass (NoMethodError)

我已检查过 UTF8 编码、服务器资源等各种因素,但现在不知还能检查什么。
有什么建议吗?
谢谢。

我目前正在运行一个 800 万条帖子的 vBulletin 导入。我已经添加了对点赞(似乎是某个插件或修改)和投票的支持。

从错误信息中我还无法完全确定问题所在。我猜是某种情况下找不到 parentid

我认为你需要以某种方式修复这段代码:

    parent_category_id: category_id_from_imported_category_id(category["parentid"])

使其在 category['parentid'] 为 nil 时也不会报错。

1 个赞

谢谢。我再次查看后发现,管理员通过设置父级 ID 为 -1(该 ID 实际上不存在)来创建了“分类区块”。

3 个赞

没错。看来你已经搞定了。出现这类问题其实是常态而非例外。接下来你得决定是直接在数据库里修复,还是修改代码来适配这个有问题的数据库。

3 个赞

任何数据迁移都是如此,无论你找到什么脚本,都无法涵盖所有突发情况。更糟糕的是,我唯一有空处理这件事的时间似乎总是在深夜(这是我为车友会免费做的)。vBulletin 网站经过了大量定制,所以我会看看还会出现什么其他意外情况。

4 个赞

我理解有一个脚本可以处理 vBulletin 4 的导入,但我没看到任何关于将所有 URL 重定向到新 Discourse URL 格式的内容。

你们是如何处理这个问题的?你们论坛上的所有外部链接会发生什么变化?

在这里:

3 个赞

谢谢 @RGJ,但你能解释一下这在现实中是如何工作的吗?这个脚本具体在做什么?它是否在 Discourse 中创建某种别名 URL,指向当前/正确的已导入 Discourse URL?

你建议如何将旧 Vbulletin 域名(www.example1.com)迁移到新的 Discourse 域名(www.example2.com)?

我认为,最理想的情况是旧论坛域名能够基于 301 重定向规则列表,将所有传入流量和链接重定向到新域名。你建议如何生成这样的重定向规则列表?

不必更改域名,但如果你要更改,则需要分两步进行:

  1. 将旧域名的所有内容重定向到新域名
  2. Discourse 的永久链接会将 vBulletin 风格的 URL 转换为正确的 Discourse 主题。

如果你不更改域名,只是将其指向新的 Discourse 设置,那么你只需执行第 2 步。

1 个赞

Discourse 的重定向 HTTP 头(301 或 302)表现如何?

从 SEO 的角度来看,我关心的是更换域名是否会影响排名。

301 永久移动

“永久链接”这个词已经说明了一切 :slight_smile:

1 个赞

如果您访问 /admin/customize/permalinks 并创建一个固定链接,即可亲自查看其工作原理。

我在附件未完整导入方面遇到了问题,与之前提到的情况类似,但脚本没有输出任何错误。
数据库很小(71M),整个导入过程在 0 分 23 秒内完成。


大部分帖子中的附件都缺失了。
我直接在 vb4 数据库中运行了脚本中的 SQL 查询,它们返回了正确的数据,因此目前我不确定问题出在哪里……

那些缺失的附件是否并未直接在帖子中链接?我认为脚本只会抓取帖子中提到的图片,而不是仅仅附加在帖子上的图片。

我有一个脚本可以导入这些内容,但尚未成功提交 PR。

是的,我觉得你说得对,@pfaffman,情况确实如此。
等你上传那个脚本后,我会等着的!

如果你有预算,请告诉我。我打算在完成这次导入后提交一个版本,但我需要删除大量仅用于此次导入的代码,这就是为什么一年前没有完成的原因……

1 个赞