Markdown 也应该有效,但我猜使用 <strong> 甚至可以解决更多边缘情况。请注意,混合 HTML 和 Markdown 也会有一些陷阱……这是一个简单的 Markdown 解决方案:
**多行\
\
文本**
我想知道您是从哪个版本的 phpBB 导入的?与早期版本相比,将 BBCode 转换为 Markdown 在 3.2 版本中效果要好得多。理想情况下,您甚至不应该在导入的帖子中看到 [b]。
Markdown 也应该有效,但我猜使用 <strong> 甚至可以解决更多边缘情况。请注意,混合 HTML 和 Markdown 也会有一些陷阱……这是一个简单的 Markdown 解决方案:
**多行\
\
文本**
我想知道您是从哪个版本的 phpBB 导入的?与早期版本相比,将 BBCode 转换为 Markdown 在 3.2 版本中效果要好得多。理想情况下,您甚至不应该在导入的帖子中看到 [b]。
我猜你是对的,我不知道为什么我一开始没考虑到……
我正在从 phpBB 3.0.7-PL1 迁移。
如果您在导入前升级到 3.2,那将对您大有裨益。![]()
请确保通过运行 phpBB 解析器将所有帖子中的 BBCodes 迁移到新的存储格式:https://www.phpbb.com/support/docs/en/3.3/kb/article/phpbb-32%2B-text-reparser/
我一开始也考虑过,但是……我讨厌电脑 stuff ![]()
我对 phpBB 不太了解,而且我不想处理从这么老的版本更新时可能发生的任何错误。
由于 Discourse 迁移脚本与 phpBB 3.0 兼容,所以我选择不升级 phpBB……
也许我遇到的一些 bbcode 问题如果升级了 phpBB 就可以避免了。比如嵌套列表、带换行的 [b] 等等…… ![]()
但是,自从我去年十二月开始进行导入工作以来,我快要完成一个运行良好的导入了(理想情况下,新论坛可能在两周内上线……),我不确定现在是否想尝试升级 phpBB,尤其是如果我必须审查我所做的所有自定义导入修复,看看 phpBB 3.2 导入器是否能更好地处理这些问题
。这会很耗时。
话虽如此……如果我足够无聊,我可以在这个周末下午尝试一下!
编辑:我试过了;迁移到新服务器然后升级到 pbpBB 3.2 很麻烦。HTTPS 问题。缓存问题。其他问题。复杂而令人沮丧的程序。官方教程建议使用需要过时 PHP 版本的工具(嘿,PHP 5,好久不见……)。显然,我有时会无聊,但还没到疯狂的地步——至少不足以做这种事情。
Gerhard!你在误导!升级到 3.2 并不是什么大恩惠! ![]()
但关于 phpBB 本身就说到这里……赞美 Discourse 的一键升级吧。
您好,
我正在尝试将 WordPress 用户迁移到 Discourse。我能够按照说明连接到我们的 WP 数据库并在 Docker 容器中导入用户。我想确保在迁移期间或之后不会发送任何电子邮件,因为我们正在使用 SSO WordPress 插件。
我在电子邮件前加上了“import_”前缀,这样万一迁移完成后有后台任务发送电子邮件确认,他们也不会收到。
我看到迁移后设置了 last_emailed_at 列:
我知道这是在 ImportScripts::Base::create_user() 中通过 opts[:last_emailed_at] = opts.fetch(:last_emailed_at, Time.now) 设置的。
是否有类似于在 ImportScripts::Base::create_admin 中用于确认电子邮件的 admin.email_tokens.update_all(confirmed: true) 的类似函数?
我看不到任何显示已发送电子邮件的日志。实际上发送了电子邮件吗?在我将电子邮件更改为有效地址后,Discourse 会尝试发送电子邮件吗?
这与主题无关,因为这个主题是关于 phpBB3 迁移的…… ![]()
我建议使用 .invalid 域,如果你想确保某些用户永远不会收到电子邮件(例如 foo@mywpimport.invalid)。但是,如果你只是想在准备好之前禁用传出电子邮件,将 disable_emails 站点设置设置为“yes”或“non-staff”是你的最佳选择!
传出电子邮件会在导入期间自动禁用。last_emailed_at 属性的值可能是 Discourse _尝试_发送电子邮件之前,在发现不允许发送后留下的。
Discourse 在迁移 之后 肯定会尝试发送电子邮件。
谢谢,我首先尝试将电子邮件字段设置为空字符串,然后 ImportScript 基类生成了带有无效域的假电子邮件。它们还设置了 last_emailed_at 属性。
所以你的意思是,一旦我从数据库中更正了电子邮件,Discourse 就会尝试发送电子邮件?但是通过 WordPress 身份验证的正常登录不需要电子邮件确认。使用 ImportScript 有没有办法绕过这个问题?
我的迁移已完成并成功。
但是,我遇到了两个问题。请告知我这是否是离题的。
一些帖子的内容包含此类内容:
[url=https://www.casimages.com/i/1907271141431956116331631.jpg.html][
[img]https://nsm09.casimages.com/img/2019/07/27//1907271141431956116331631.jpg[/img][/url]
图片在预览中显示,但在帖子本身中是损坏的,即使在重建 HTML 之后也是如此:
每张图片的生成 HTML 是:
<p><a href="https://www.casimages.com/i/1907271151181956116331666.jpg.html" data-bbcode="true"><span alt="" class="broken-image" title="This image is broken"><svg class="fa d-icon d-icon-unlink svg-icon" aria-hidden="true"><use href="#unlink"></use></svg></span></a></p>
我在许多帖子中都遇到了这个问题。您有什么方法可以全局修复它吗?
就像许多旧论坛一样,旧的 Imageshack 链接很长时间以来一直是损坏的,而且永远都是。但现在一些链接显示的是乌克兰国旗而不是空白:
您将如何处理这种行为?
我对任何想法都持开放态度,但一位论坛管理员有一个旧硬盘驱动器上整个论坛的静态备份,其中大部分旧图片都是有效的(已下载并本地存储)。我正在考虑将来也许可以创建一个脚本,用静态版本中的有效图片替换所有 Imageshack 的“死链接”。这似乎非常棘手,但因此,我不确定我是否想简单地将所有 Imageshack 链接从论坛中删除,用空字符串或其他东西替换它们。
是换行符导致的问题吗?我猜是这样。您需要重新映射这些 BBCodes 以删除换行符。Replace a string in all posts 应该会有帮助。
也许暂时将它们转换为 HTML 注释?稍后您可以将它们替换为存储的图像。
It doesn’t seem that’s the issue:
I added line breaks so the content looks like this:
[url=https://www.casimages.com/i/1907271141431956116331631.jpg.html]
[img]https://nsm09.casimages.com/img/2019/07/27//1907271141431956116331631.jpg[/img]
[/url]
And the result:
Example posts:
Yes, that’s a good idea!
So basically, replacing the strings (from the topic you linked) using regexes to target Imageshack links only, right?
所以,经过新行的实验,这并不是问题所在。
但是,如果我将帖子内容复制粘贴到同一个论坛的新帖子中,内容就会正确显示
:
对比:
我尝试重新烘焙带有损坏图片的帖子(这些图片在消息预览中正确显示,请参阅我之前的帖子),但没有解决任何问题。
据我所知,两个帖子的原始内容完全相同。
但是第一个帖子(第二行)的烘焙内容会导致图片损坏:
我感到很困惑。
Odd thing:
If I try to rebuild the HTML of any post, I got an error 500:
Logs show a fatal error and a warning:
ArgumentError (wrong number of arguments (given 0, expected 1)) lib/guardian/ensure_magic.rb:11:in 'method_missing' app/controllers/posts_controller.rb:570:in 'rebake' app/controllers/application_cont
plugins/discourse-chat/lib/guardian_extensions.rb:71:in `can_rebake?'
lib/guardian/ensure_magic.rb:11:in `method_missing'
app/controllers/posts_controller.rb:570:in `rebake'
actionpack (6.1.4.1) lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
actionpack (6.1.4.1) lib/abstract_controller/base.rb:228:in `process_action'
actionpack (6.1.4.1) lib/action_controller/metal/rendering.rb:30:in `process_action'
actionpack (6.1.4.1) lib/abstract_controller/callbacks.rb:42:in `block in process_action'
activesupport (6.1.4.1) lib/active_support/callbacks.rb:117:in `block in run_callbacks'
app/controllers/application_controller.rb:397:in `block in with_resolved_locale'
i18n (1.10.0) lib/i18n.rb:328:in `with_locale'
app/controllers/application_controller.rb:397:in `with_resolved_locale'
activesupport (6.1.4.1) lib/active_support/callbacks.rb:126:in `block in run_callbacks'
activesupport (6.1.4.1) lib/active_support/callbacks.rb:137:in `run_callbacks'
actionpack (6.1.4.1) lib/abstract_controller/callbacks.rb:41:in `process_action'
actionpack (6.1.4.1) lib/action_controller/metal/rescue.rb:22:in `process_action'
actionpack (6.1.4.1) lib/action_controller/metal/instrumentation.rb:34:in `block in process_action'
activesupport (6.1.4.1) lib/active_support/notifications.rb:203:in `block in instrument'
activesupport (6.1.4.1) lib/active_support/notifications/instrumenter.rb:24:in `instrument'
activesupport (6.1.4.1) lib/active_support/notifications.rb:203:in `instrument'
actionpack (6.1.4.1) lib/action_controller/metal/instrumentation.rb:33:in `process_action'
actionpack (6.1.4.1) lib/action_controller/metal/params_wrapper.rb:249:in `process_action'
activerecord (6.1.4.1) lib/active_record/railties/controller_runtime.rb:27:in `process_action'
actionpack (6.1.4.1) lib/abstract_controller/base.rb:165:in `process'
actionview (6.1.4.1) lib/action_view/rendering.rb:39:in `process'
rack-mini-profiler (3.0.0) lib/mini_profiler/profiling_methods.rb:85:in `block in profile_method'
actionpack (6.1.4.1) lib/action_controller/metal.rb:190:in `dispatch'
actionpack (6.1.4.1) lib/action_controller/metal.rb:254:in `dispatch'
actionpack (6.1.4.1) lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
actionpack (6.1.4.1) lib/action_dispatch/routing/route_set.rb:33:in `serve'
actionpack (6.1.4.1) lib/action_dispatch/journey/router.rb:50:in `block in serve'
actionpack (6.1.4.1) lib/action_dispatch/journey/router.rb:32:in `each'
actionpack (6.1.4.1) lib/action_dispatch/journey/router.rb:32:in `serve'
actionpack (6.1.4.1) lib/action_dispatch/routing/route_set.rb:842:in `call'
lib/middleware/omniauth_bypass_middleware.rb:71:in `call'
rack (2.2.3) lib/rack/tempfile_reaper.rb:15:in `call'
rack (2.2.3) lib/rack/conditional_get.rb:40:in `call'
rack (2.2.3) lib/rack/head.rb:12:in `call'
actionpack (6.1.4.1) lib/action_dispatch/http/permissions_policy.rb:22:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:358:in `call'
rack (2.2.3) lib/rack/session/abstract/id.rb:266:in `context'
rack (2.2.3) lib/rack/session/abstract/id.rb:260:in `call'
actionpack (6.1.4.1) lib/action_dispatch/middleware/cookies.rb:689:in `call'
actionpack (6.1.4.1) lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
activesupport (6.1.4.1) lib/active_support/callbacks.rb:98:in `run_callbacks'
actionpack (6.1.4.1) lib/action_dispatch/middleware/callbacks.rb:26:in `call'
actionpack (6.1.4.1) lib/action_dispatch/middleware/actionable_exceptions.rb:18:in `call'
actionpack (6.1.4.1) lib/action_dispatch/middleware/debug_exceptions.rb:29:in `call'
actionpack (6.1.4.1) lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
logster (2.10.1) lib/logster/middleware/reporter.rb:43:in `call'
railties (6.1.4.1) lib/rails/rack/logger.rb:37:in `call_app'
railties (6.1.4.1) lib/rails/rack/logger.rb:28:in `call'
config/initializers/100-quiet_logger.rb:23:in `call'
config/initializers/100-silence_logger.rb:31:in `call'
actionpack (6.1.4.1) lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
actionpack (6.1.4.1) lib/action_dispatch/middleware/request_id.rb:26:in `call'
lib/middleware/enforce_hostname.rb:23:in `call'
rack (2.2.3) lib/rack/method_override.rb:24:in `call'
actionpack (6.1.4.1) lib/action_dispatch/middleware/executor.rb:14:in `call'
rack (2.2.3) lib/rack/sendfile.rb:110:in `call'
actionpack (6.1.4.1) lib/action_dispatch/middleware/host_authorization.rb:92:in `call'
rack-mini-profiler (3.0.0) lib/mini_profiler/profiler.rb:249:in `call'
message_bus (4.2.0) lib/message_bus/rack/middleware.rb:60:in `call'
lib/middleware/request_tracker.rb:202:in `call'
railties (6.1.4.1) lib/rails/engine.rb:539:in `call'
railties (6.1.4.1) lib/rails/railtie.rb:207:in `public_send'
railties (6.1.4.1) lib/rails/railtie.rb:207:in `method_missing'
rack (2.2.3) lib/rack/urlmap.rb:74:in `block in call'
rack (2.2.3) lib/rack/urlmap.rb:58:in `each'
rack (2.2.3) lib/rack/urlmap.rb:58:in `call'
unicorn (6.1.0) lib/unicorn/http_server.rb:634:in `process_client'
unicorn (6.1.0) lib/unicorn/http_server.rb:739:in `worker_loop'
unicorn (6.1.0) lib/unicorn/http_server.rb:547:in `spawn_missing_workers'
unicorn (6.1.0) lib/unicorn/http_server.rb:143:in `start'
unicorn (6.1.0) bin/unicorn:128:in `<top (required)>'
vendor/bundle/ruby/2.7.0/bin/unicorn:25:in `load'
vendor/bundle/ruby/2.7.0/bin/unicorn:25:in `<main>'
It was in safe-mode with all theme and plugins disabled, but this code block mentions on the first line:
plugins/discourse-chat/lib/guardian_extensions.rb:71:in 'can_rebake?'
Failed to handle exception in exception app middleware : ArgumentError : wrong number of arguments (given 0, expected 1)
/var/www/discourse/plugins/discourse-chat/lib/guardian_extensions.rb:71:in `can_rebake?'
/var/www/discourse/lib/guardian/ensure_magic.rb:11:in `method_missing'
/var/www/discourse/app/controllers/posts_controller.rb:570:in `rebake'
actionpack-6.1.4.1/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
actionpack-6.1.4.1/lib/abstract_controller/base.rb:228:in `process_action'
actionpack-6.1.4.1/lib/action_controller/metal/rendering.rb:30:in `process_action'
actionpack-6.1.4.1/lib/abstract_controller/callbacks.rb:42:in `block in process_action'
activesupport-6.1.4.1/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
/var/www/discourse/app/controllers/application_controller.rb:397:in `block in with_resolved_locale'
i18n-1.10.0/lib/i18n.rb:328:in `with_locale'
/var/www/discourse/app/controllers/application_controller.rb:397:in `with_resolved_locale'
activesupport-6.1.4.1/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
activesupport-6.1.4.1/lib/active_support/callbacks.rb:137:in `run_callbacks'
actionpack-6.1.4.1/lib/abstract_controller/callbacks.rb:41:in `process_action'
actionpack-6.1.4.1/lib/action_controller/metal/rescue.rb:22:in `process_action'
actionpack-6.1.4.1/lib/action_controller/metal/instrumentation.rb:34:in `block in process_action'
activesupport-6.1.4.1/lib/active_support/notifications.rb:203:in `block in instrument'
activesupport-6.1.4.1/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
activesupport-6.1.4.1/lib/active_support/notifications.rb:203:in `instrument'
actionpack-6.1.4.1/lib/action_controller/metal/instrumentation.rb:33:in `process_action'
actionpack-6.1.4.1/lib/action_controller/metal/params_wrapper.rb:249:in `process_action'
activerecord-6.1.4.1/lib/active_record/railties/controller_runtime.rb:27:in `process_action'
actionpack-6.1.4.1/lib/abstract_controller/base.rb:165:in `process'
actionview-6.1.4.1/lib/action_view/rendering.rb:39:in `process'
rack-mini-profiler-3.0.0/lib/mini_profiler/profiling_methods.rb:85:in `block in profile_method'
actionpack-6.1.4.1/lib/action_controller/metal.rb:190:in `dispatch'
actionpack-6.1.4.1/lib/action_controller/metal.rb:254:in `dispatch'
actionpack-6.1.4.1/lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
actionpack-6.1.4.1/lib/action_dispatch/routing/route_set.rb:33:in `serve'
actionpack-6.1.4.1/lib/action_dispatch/journey/router.rb:50:in `block in serve'
actionpack-6.1.4.1/lib/action_dispatch/journey/router.rb:32:in `each'
actionpack-6.1.4.1/lib/action_dispatch/journey/router.rb:32:in `serve'
actionpack-6.1.4.1/lib/action_dispatch/routing/route_set.rb:842:in `call'
/var/www/discourse/lib/middleware/omniauth_bypass_middleware.rb:71:in `call'
rack-2.2.3/lib/rack/tempfile_reaper.rb:15:in `call'
rack-2.2.3/lib/rack/conditional_get.rb:40:in `call'
rack-2.2.3/lib/rack/head.rb:12:in `call'
actionpack-6.1.4.1/lib/action_dispatch/http/permissions_policy.rb:22:in `call'
/var/www/discourse/lib/content_security_policy/middleware.rb:12:in `call'
/var/www/discourse/lib/middleware/anonymous_cache.rb:358:in `call'
rack-2.2.3/lib/rack/session/abstract/id.rb:266:in `context'
rack-2.2.3/lib/rack/session/abstract/id.rb:260:in `call'
actionpack-6.1.4.1/lib/action_dispatch/middleware/cookies.rb:689:in `call'
actionpack-6.1.4.1/lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
activesupport-6.1.4.1/lib/active_support/callbacks.rb:98:in `run_callbacks'
actionpack-6.1.4.1/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
actionpack-6.1.4.1/lib/action_dispatch/middleware/actionable_exceptions.rb:18:in `call'
actionpack-6.1.4.1/lib/action_dispatch/middleware/debug_exceptions.rb:29:in `call'
actionpack-6.1.4.1/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
logster-2.10.1/lib/logster/middleware/reporter.rb:43:in `call'
railties-6.1.4.1/lib/rails/rack/logger.rb:37:in `call_app'
railties-6.1.4.1/lib/rails/rack/logger.rb:28:in `call'
/var/www/discourse/config/initializers/100-quiet_logger.rb:23:in `call'
/var/www/discourse/config/initializers/100-silence_logger.rb:31:in `call'
actionpack-6.1.4.1/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
actionpack-6.1.4.1/lib/action_dispatch/middleware/request_id.rb:26:in `call'
/var/www/discourse/lib/middleware/enforce_hostname.rb:23:in `call'
rack-2.2.3/lib/rack/method_override.rb:24:in `call'
actionpack-6.1.4.1/lib/action_dispatch/middleware/executor.rb:14:in `call'
rack-2.2.3/lib/rack/sendfile.rb:110:in `call'
actionpack-6.1.4.1/lib/action_dispatch/middleware/host_authorization.rb:92:in `call'
rack-mini-profiler-3.0.0/lib/mini_profiler/profiler.rb:249:in `call'
message_bus-4.2.0/lib/message_bus/rack/middleware.rb:60:in `call'
/var/www/discourse/lib/middleware/request_tracker.rb:202:in `call'
railties-6.1.4.1/lib/rails/engine.rb:539:in `call'
railties-6.1.4.1/lib/rails/railtie.rb:207:in `public_send'
railties-6.1.4.1/lib/rails/railtie.rb:207:in `method_missing'
rack-2.2.3/lib/rack/urlmap.rb:74:in `block in call'
rack-2.2.3/lib/rack/urlmap.rb:58:in `each'
rack-2.2.3/lib/rack/urlmap.rb:58:in `call'
unicorn-6.1.0/lib/unicorn/http_server.rb:634:in `process_client'
unicorn-6.1.0/lib/unicorn/http_server.rb:739:in `worker_loop'
unicorn-6.1.0/lib/unicorn/http_server.rb:547:in `spawn_missing_workers'
unicorn-6.1.0/lib/unicorn/http_server.rb:143:in `start'
unicorn-6.1.0/bin/unicorn:128:in `<top (required)>'
/var/www/discourse/vendor/bundle/ruby/2.7.0/bin/unicorn:25:in `load'
/var/www/discourse/vendor/bundle/ruby/2.7.0/bin/unicorn:25:in `<main>'
Do this information help?
I’m doing what I can to try to repair these posts, but I’m starting to believe this has something to do with Discourse itself and not something on my side maybe? ![]()
edit: see the automatically linked post below.
Issue resolved:
Now I just have to rebake all my posts. ![]()
Another edit:
Could have worked for sure, and will for images that still have their old plain URL, but:
Since all the old Imageshack broken links were replaced by valid images displaying a Ukraine flag by Imageshack itself, they were automatically uploaded to Discourse, changing their URL to a markdown local image link.
Fortunately, all these flags were uploaded to Discourse with identical links ( in my case - excellent Discourse behavior by the way
), which means that they will be very easy to target and remove/replace with something else. ![]()
I’m just writing this to inform people that would encounter the same issue as me after a migration.
看起来 poll_option_total 的值有时是错误的。我看到每个选项的非匿名投票数多于 poll_option_total 的值。而且所有这些用户都存在。
使用 GREATEST(..., 0) 可以解决。至少它不会崩溃。
SELECT o.poll_option_id, o.poll_option_text, o.poll_option_total AS total_votes,
GREATEST(CAST(o.poll_option_total AS SIGNED) - (
SELECT COUNT(DISTINCT v.vote_user_id)
FROM #{@table_prefix}poll_votes v
JOIN #{@table_prefix}users u ON (v.vote_user_id = u.user_id)
JOIN #{@table_prefix}topics t ON (v.topic_id = t.topic_id)
WHERE v.poll_option_id = o.poll_option_id AND v.topic_id = o.topic_id
),0) AS anonymous_votes
FROM #{@table_prefix}poll_options o
WHERE o.topic_id = #{topic_id}
ORDER BY o.poll_option_id
我真的很想把我的公司从 phpbb 3.3 论坛迁移到 Discourse。有人知道什么时候会支持吗?
太棒了,谢谢!
如果我应该为此开启一个新主题,我提前道歉。
我有一个位于子文件夹中的 phpBB 论坛:
thedomain.com/forum/
我计划使用导入脚本从 phpBB 迁移到子域中的 Discourse;即:
forum.thedomain.com
因此,看起来我需要做的——对于域名和永久链接——就是在新站点上使用 HTTPS 在 settings.yml 中设置以下内容:
site_prefix:
# this is needed for rewriting internal links in posts
original: thdomain.com/forum # without http(s)://
new: https://forum.thedomain.com # with http:// or https://
# Enable this, if you want to redirect old forum links to the the new locations.
permalinks:
categories: true # redirects /viewforum.php?f=1 to /c/category-name
topics: true # redirects /viewtopic.php?f=6&t=43 to /t/topic-name/81
posts: true # redirects /viewtopic.php?p=2455#p2455 to /t/topic-name/81/4
# Append a prefix to each type of link, e.g. 'forum' to redirect /forum/viewtopic.php?f=6&t=43 to /t/topic-name/81
# Leave it empty if your forum wasn't installed in a subfolder.
prefix: forum
然后,在运行 Apache 的原始服务器上,在 .htaccess 中,RewriteEngine 已经开启,我需要:
RewriteCond %{HTTP_HOST} ^thedomain.com
RewriteRule ^forum/(.*)$ https://forum.thedomain.com/$1 [L,R=301]
如果真的这么简单,这个脚本就太棒了!![]()
我还有几个额外的问题:
这会稍微减慢导入速度,但您不必担心。它主要默认禁用是因为很少需要它。
是的,没问题。
我在准备这次导入时遇到了一个难题。
我计划迁移的 phpBB 论坛正在使用一个自定义的 BBcode,该 BBcode 会为存储在用户帐户外部但位于同一用户帐户上的目录中的图像创建 HTML img 标签。该 BBcode 的格式如下:
[Gallery]{NUMBER1}|{NUMBER2}|{NUMBER3}|{SIMPLETEXT}[/Gallery]
{NUMBER1} 和 {NUMBER2} 分别是图像的宽度和高度的整数。{NUMBER3} 是图像所在年份文件夹的整数,{SIMPLETEXT} 是图像文件名。BBcode 的 HTML 替换如下所示:
<img class="postimage gallery-image" src="/gallery/files/{NUMBER3}/{SIMPLETEXT}" width="{NUMBER1}" height="{NUMBER2}" />
我需要弄清楚如何处理迁移脚本中的此自定义 BBcode,包括将自定义 BBcode 转换为 Discourse 可以使用的内容,以及确定在文件树中将图像文件放在哪里以进行导入。
我查看了 Ruby-BBcode-to-MD,它说“通过编辑 tags.rb 可以轻松地用自定义标签扩展此集合。”我查看了 tags.rb,但由于这是我第一次查看 Ruby 代码,所以我不知道如何处理我的自定义 BBcode,因为它的管道分隔格式与 tags.rb 文件中可能用作指南的任何官方 BBcode 都不同。
我还没有加载 templates/import/phpbb3.template.yml,所以我想这会添加 Ruby BBcode 到 MD gem?
所以我有几个问题:
这个 gem 不再被真正使用了。您正在从哪个版本的 phpBB 导入?如果是 v3.1 或更低版本,您需要在 discourse/script/import_scripts/phpbb3/support/text_processor.rb at ea2fd75d10e81687334f8d29e0d3e786dbdb4a53 · discourse/discourse · GitHub 中应用一些正则表达式技巧。
对于 v3.2,您可以在 discourse/script/import_scripts/phpbb3/support/bbcode/xml_to_markdown.rb at a71b219c9a18ad418e330282fde511bcb79ba7c4 · discourse/discourse · GitHub 中添加 BBCode 处理。