DEV: use DiskSpace module for all disk space calculations

This normalizes it so we only carry one place for grabbing disk space size

It also normalizes the command made so it uses Discourse.execute_command
which splits off params in a far cleaner way.
This commit is contained in:
Sam Saffron
2020-02-18 15:13:09 +11:00
parent 28292d2759
commit 64b3512084
3 changed files with 12 additions and 4 deletions

View File

@@ -685,7 +685,7 @@ class CookedPostProcessor
end
def available_disk_space
100 - `df -P #{Rails.root}/public/uploads | tail -1 | tr -s ' ' | cut -d ' ' -f 5`.to_i
100 - DiskSpace.percent_free("#{Rails.root}/public/uploads")
end
def dirty?