# phpBB3 导入脚本的增强请求

**URL:** <https://meta.discourse.org/t/enhancement-request-to-phpbb3-import-script/393476>\
**Category:** Migration\
**Tags:** phpbb\
**Created:** [2026年一月14日 20:04 UTC](https://meta.discourse.org/t/enhancement-request-to-phpbb3-import-script/393476 "2026-01-14T20:04:29Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![italo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/italo/32/315833_2.png) [@italo](https://meta.discourse.org/u/italo)\
**Post date:** [2026年一月15日 03:56 UTC](https://meta.discourse.org/t/enhancement-request-to-phpbb3-import-script/393476/5 "2026-01-15T03:56:55Z")

</div>

看起来很棘手，但您可能可以通过修改此处的此方法获得成功：

> <https://github.com/discourse/discourse/blob/3324fe4fef784ce7a2800ad025c85a08a35f7f45/script/import_scripts/phpbb3/support/text_processor.rb#L169>

用这个代替：

```ruby
text.gsub!(attachment_regexp) do
        index = $1.to_i
        real_filename = $2
        unreferenced_attachments[index] = nil
        attachments.fetch(index, real_filename)
end

```

您会想要类似这样的东西：

```ruby
text.gsub!(attachment_regexp) do
        index = $1.to_i
        description = $2.strip
        unreferenced_attachments[index] = nil

        url = attachments.fetch(index, description)

        "![#{description}](#{url})"
end

```

_这只是一个未经测试的示例，用来说明需要修改的位置。我可能是错的。_

如果我明天有时间，我可能会提交一个带有真正解决方案的拉取请求 (PR)。😄

---

_[View the full topic](https://meta.discourse.org/t/enhancement-request-to-phpbb3-import-script/393476)._
