Merge pull request #4337 from tgxworld/disable_readonly_mode_during_backup

FEATURE: Add SiteSetting to disable readonly mode during backup.
This commit is contained in:
Guo Xiang Tan 2016-07-19 17:53:54 +08:00 committed by GitHub
commit d4a80f9c6e
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