FEATURE: Add SiteSetting to disable readonly mode during backup.

This commit is contained in:
Guo Xiang Tan 2016-07-19 17:44:04 +08:00
parent 374592d599
commit 1adfa0a4b5
3 changed files with 4 additions and 1 deletions

View File

@ -1008,6 +1008,7 @@ en:
github_client_id: "Client id for Github authentication, registered at https://github.com/settings/applications"
github_client_secret: "Client secret for Github authentication, registered at https://github.com/settings/applications"
readonly_mode_during_backup: "Enable read only mode while taking a backup"
allow_restore: "Allow restore, which can replace ALL site data! Leave false unless you plan to restore a backup"
maximum_backups: "The maximum amount of backups to keep on disk. Older backups are automatically deleted"
automatic_backups_enabled: "Run automatic backups as defined in backup frequency"

View File

@ -970,6 +970,8 @@ legal:
default: ''
backups:
readonly_mode_during_backup:
default: true
allow_restore:
default: false
maximum_backups:

View File

@ -89,7 +89,7 @@ module BackupRestore
@archive_directory = File.join(Rails.root, "public", "backups", @current_db)
@archive_basename = File.join(@archive_directory, "#{SiteSetting.title.parameterize}-#{@timestamp}")
@logs = []
@readonly_mode_was_enabled = Discourse.readonly_mode?
@readonly_mode_was_enabled = Discourse.readonly_mode? || !SiteSetting.readonly_mode_during_backup
end
def listen_for_shutdown_signal