FIX: correct upload statistics report for external storage
Follows up #64b35120 This also corrects it so bytes used for internal storage counts all the space used, previously it was only counting uploads not optimized images. Additionally we now correctly count storage for optimized images.
This commit is contained in:
parent
254b57c812
commit
a3d576534a
|
@ -2,13 +2,19 @@
|
|||
|
||||
class DiskSpace
|
||||
def self.uploads_used_bytes
|
||||
# used(uploads_path)
|
||||
# temporary (on our internal setup its just too slow to iterate)
|
||||
Upload.sum(:filesize).to_i
|
||||
if Discourse.store.external?
|
||||
Upload.sum(:filesize).to_i + OptimizedImage.sum(:filesize).to_i
|
||||
else
|
||||
used(uploads_path)
|
||||
end
|
||||
end
|
||||
|
||||
def self.uploads_free_bytes
|
||||
free(uploads_path)
|
||||
if Discourse.store.external?
|
||||
0
|
||||
else
|
||||
free(uploads_path)
|
||||
end
|
||||
end
|
||||
|
||||
def self.free(path)
|
||||
|
|
Loading…
Reference in New Issue