mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 22:43:33 +08:00
FIX: log backups download/destroy staff action
FIX: clean up junk left by the specs RENAME: 'backup_operation' to 'backup_create' to match other backup log types
This commit is contained in:
@ -32,7 +32,7 @@ class Admin::BackupsController < Admin::AdminController
|
||||
rescue BackupRestore::OperationRunningError
|
||||
render json: failed_json.merge(message: I18n.t("backup.operation_already_running"))
|
||||
else
|
||||
StaffActionLogger.new(current_user).log_backup_operation
|
||||
StaffActionLogger.new(current_user).log_backup_create
|
||||
render json: success_json
|
||||
end
|
||||
|
||||
@ -46,9 +46,9 @@ class Admin::BackupsController < Admin::AdminController
|
||||
|
||||
# download
|
||||
def show
|
||||
filename = params.fetch(:id)
|
||||
if backup = Backup[filename]
|
||||
headers['Content-Length'] = File.size(backup.path)
|
||||
if backup = Backup[params.fetch(:id)]
|
||||
StaffActionLogger.new(current_user).log_backup_download(backup)
|
||||
headers['Content-Length'] = File.size(backup.path).to_s
|
||||
send_file backup.path
|
||||
else
|
||||
render nothing: true, status: 404
|
||||
@ -56,8 +56,8 @@ class Admin::BackupsController < Admin::AdminController
|
||||
end
|
||||
|
||||
def destroy
|
||||
backup = Backup[params.fetch(:id)]
|
||||
if backup
|
||||
if backup = Backup[params.fetch(:id)]
|
||||
StaffActionLogger.new(current_user).log_backup_destroy(backup)
|
||||
backup.remove
|
||||
render nothing: true
|
||||
else
|
||||
|
Reference in New Issue
Block a user