# 将 vBulletin 4 论坛迁移到 Discourse

**URL:** <https://meta.discourse.org/t/migrate-a-vbulletin-4-forum-to-discourse/54881>\
**Category:** Sysadmins\
**Tags:** how-to\
**Created:** [2016年十二月28日 14:59 UTC](https://meta.discourse.org/t/migrate-a-vbulletin-4-forum-to-discourse/54881 "2016-12-28T14:59:29Z")\
**Posts on this page:** 4\
**Page:** 10

<div class="post-metadata">

**Author:** ![tom1984](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tom1984/32/528342_2.png) [@tom1984](https://meta.discourse.org/u/tom1984)\
**Post date:** [2025年十一月8日 12:44 UTC](https://meta.discourse.org/t/migrate-a-vbulletin-4-forum-to-discourse/54881/197 "2025-11-08T12:44:29Z")

</div>

哦。  
就在我以为自己即将成功的时候 😭

---

<div class="post-metadata">

**Author:** ![tom1984](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tom1984/32/528342_2.png) [@tom1984](https://meta.discourse.org/u/tom1984)\
**Post date:** [2025年十一月8日 13:28 UTC](https://meta.discourse.org/t/migrate-a-vbulletin-4-forum-to-discourse/54881/198 "2025-11-08T13:28:49Z")

</div>

它正在运行 😎

我必须承认，chatgpt 帮了我。需要替换：

```plaintext
def parse_timestamp(timestamp)
  Time.zone.at(@tz.utc_to_local(timestamp))
end

```

就在导入脚本的最底部

为：

```plaintext
def parse_timestamp(timestamp)
  return nil if timestamp.nil? || timestamp.to_i == 0

  # Convert integer → Time → Apply timezone → Convert to Rails Time.zone
  utc_time = Time.at(timestamp.to_i).utc
  local_time = @tz.utc_to_local(utc_time)
  Time.zone.at(local_time)
end

```

……它现在正在快速处理主题，但我可以看到内容出现在网站上。之后我会（希望）报告成功。如果成功，我可能会在这里创建一个关于我如何让它全部正常工作的指南。

---

<div class="post-metadata">

**Author:** ![tom1984](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tom1984/32/528342_2.png) [@tom1984](https://meta.discourse.org/u/tom1984)\
**Post date:** [2025年十一月9日 17:32 UTC](https://meta.discourse.org/t/migrate-a-vbulletin-4-forum-to-discourse/54881/199 "2025-11-09T17:32:26Z")

</div>

它奏效了，而且很棒。感谢 @Pfaffman 的帮助，非常感激。

现在 20 年的帖子和主题都已迁移到 discourse，需要清理的地方很少——脚本一旦运行起来就很棒 🙂

为了运行脚本，我在主机上安装了 mariadb-server。在主机上，我必须确保防火墙已打开，mysql 正在监听正确的端口，并且 root 用户通过在 mysql 中更新其用户权限，允许从远程主机（托管的 vps）访问。

（之后所有防火墙和权限都已锁定）

然后，在容器内，我将脚本指向了主机 IP（docker 默认），从那里一切顺利……除了时间问题，我在这里找到了一个解决方案：

> [@tom1984](#):
>
> ```plaintext
> def parse_timestamp(timestamp)
> Time.zone.at(@tz.utc_to_local(timestamp))
> end
> 
> ```
> 
> 就在导入脚本的最底部
> 
> 替换为：
> 
> ```plaintext
> def parse_timestamp(timestamp)
> return nil if timestamp.nil? || timestamp.to_i == 0
> 
> # Convert integer → Time → Apply timezone → Convert to Rails Time.zone
> utc_time = Time.at(timestamp.to_i).utc
> local_time = @tz.utc_to_local(utc_time)
> Time.zone.at(local_time)
> end
> 
> ```

这是我所做事情的简要概述，如果有人在尝试做同样的事情时偶然发现了这个帖子并且卡住了，请联系我，我将尽力帮助您解决我这几天学到的任何东西！

我很高兴它奏效了，我最初估计的一个周末可能差不多！

---

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [2025年十一月9日 18:05 UTC](https://meta.discourse.org/t/migrate-a-vbulletin-4-forum-to-discourse/54881/200 "2025-11-09T18:05:20Z")

</div>

太好了！很高兴你收到了！

[上一頁](https://meta.discourse.org/t/migrate-a-vbulletin-4-forum-to-discourse/54881.md?page=9)
