move notification about low disk space into its own method

This commit is contained in:
Neil Lalonde 2015-08-14 17:46:15 -04:00
parent 23a5c6444a
commit 7581a7d869
1 changed files with 6 additions and 1 deletions

View File

@ -274,12 +274,17 @@ class CookedPostProcessor
reason = I18n.t("disable_remote_images_download_reason")
staff_action_logger = StaffActionLogger.new(Discourse.system_user)
staff_action_logger.log_site_setting_change("download_remote_images_to_local", true, false, { details: reason })
# also send a private message to the site contact user
SystemMessage.create_from_system_user(Discourse.site_contact_user, :download_remote_images_disabled)
notify_about_low_disk_space
true
end
def notify_about_low_disk_space
SystemMessage.create_from_system_user(Discourse.site_contact_user, :download_remote_images_disabled)
end
def available_disk_space
100 - `df -P #{Rails.root}/public/uploads | tail -1 | tr -s ' ' | cut -d ' ' -f 5`.to_i
end