FEATURE: Allow Forums to disable the Backups feature

This commit is contained in:
Robin Ward
2017-12-21 15:21:28 -05:00
parent 9a514e6a26
commit 69a90f31fb
7 changed files with 23 additions and 3 deletions

View File

@ -2,6 +2,7 @@ require "backup_restore/backup_restore"
class Admin::BackupsController < Admin::AdminController
before_action :ensure_backups_enabled
skip_before_action :check_xhr, only: [:index, :show, :logs, :check_backup_chunk, :upload_backup_chunk]
def index
@ -178,4 +179,8 @@ class Admin::BackupsController < Admin::AdminController
`df -Pk #{Rails.root}/public/backups | awk 'NR==2 {print $4 * 1024;}'`.to_i > size
end
def ensure_backups_enabled
raise Discourse::InvalidAccess.new unless SiteSetting.enable_backups?
end
end