mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 03:21:12 +08:00
FEATURE: Improve backup stats on admin dashboard
* Dashboard doesn't timeout anymore when Amazon S3 is used for backups * Storage stats are now a proper report with the same caching rules * Changing the backup_location, s3_backup_bucket or creating and deleting backups removes the report from the cache * It shows the number of backups and the backup location * It shows the used space for the correct backup location instead of always showing used space on local storage * It shows the date of the last backup as relative date
This commit is contained in:
@ -24,7 +24,11 @@ module BackupRestore
|
||||
|
||||
def delete_file(filename)
|
||||
obj = @s3_helper.object(filename)
|
||||
obj.delete if obj.exists?
|
||||
|
||||
if obj.exists?
|
||||
obj.delete
|
||||
reset_cache
|
||||
end
|
||||
end
|
||||
|
||||
def download_file(filename, destination_path, failure_message = nil)
|
||||
@ -38,6 +42,7 @@ module BackupRestore
|
||||
raise BackupFileExists.new if obj.exists?
|
||||
|
||||
obj.upload_file(source_path, content_type: content_type)
|
||||
reset_cache
|
||||
end
|
||||
|
||||
def generate_upload_url(filename)
|
||||
@ -100,5 +105,9 @@ module BackupRestore
|
||||
SiteSetting.s3_backup_bucket
|
||||
end
|
||||
end
|
||||
|
||||
def free_bytes
|
||||
nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user