mirror of
https://github.com/discourse/discourse.git
synced 2024-12-04 09:15:55 +08:00
25 lines
530 B
Ruby
25 lines
530 B
Ruby
|
# frozen_string_literal: true
|
||
|
|
||
|
module Reports::StorageStats
|
||
|
extend ActiveSupport::Concern
|
||
|
|
||
|
class_methods do
|
||
|
def report_storage_stats(report)
|
||
|
backup_stats =
|
||
|
begin
|
||
|
BackupRestore::BackupStore.create.stats
|
||
|
rescue BackupRestore::BackupStore::StorageError
|
||
|
nil
|
||
|
end
|
||
|
|
||
|
report.data = {
|
||
|
backups: backup_stats,
|
||
|
uploads: {
|
||
|
used_bytes: DiskSpace.uploads_used_bytes,
|
||
|
free_bytes: DiskSpace.uploads_free_bytes,
|
||
|
},
|
||
|
}
|
||
|
end
|
||
|
end
|
||
|
end
|