バックアップ復元時のメール無効化

It’s great that outgoing email gets suspended when a backup is restored, along with a suitable site notice to remind the admin to switch it on.

Should / could this be extended to override POP polling too, incase that was setup and starts consuming messages?

This would be helpful where the settings “pop3 polling enabled” and “pop3 polling delete from server” are both set.

「いいね!」 4

Yes, I second that.

It would be great if there was a “don’t reach out to any external service” mode that disables all external actions that have a permanent effect on the world outside the forum, like outgoing emails (except for those that are really essential), POP3 delete from server and triggering webhooks.

「いいね!」 5

Yep - a sort of ‘isolation mode’ so that you can do a test restore of a backup (as is good practice from time to time) without any worry of impacting the running instance, or during migration you can stand up the new instance and check it over safely before making the switch (presuming the source site is in read-only mode or down etc…).

「いいね!」 2

Good point, any thoughts on this @gerhard?

「いいね!」 2

I agree. An “isolation mode” would be a useful feature. Not just after restores.

For now, something similar could be done with a simple plugin. Something like the following should work:

# name: isolation-mode
# about: Enables isolation mode after restoring backup.
# version: 1.0

after_initialize do
  on(:site_settings_restored) do
    SiteSetting.pop3_polling_enabled = false
    WebHook.update_all(active: false)
  end
end

As an alternative, you could also use the discourse restore CLI command and update site settings and whatnot afterwards with the rails runner.

「いいね!」 3

これはまだ最善のアドバイスですか?

はい、何も変更されていません。「分離モード」機能がないため、復元時に送信メール以外を無効にすることはできません。管理者に通知したり、すべてを簡単にオンに戻すオプションを提供したりする方法がないためです。

「いいね!」 1

これを私のリポジトリに追加しました(もちろん@gerhard氏にクレジットを記載しています!)。

追加したこと:

  • disable emails: はい
  • login required: true

そして、バックアップの復元が完了すると、以下のようになります。

これは、実際のユーザーメールを含む機密性の高いステージングバージョンをホストする上で、まさに救世主となります…

改めて感謝します!

「いいね!」 1