From 7581a7d8696d3614307ca04cdfedd5c0a7a32e21 Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Fri, 14 Aug 2015 17:46:15 -0400 Subject: [PATCH] move notification about low disk space into its own method --- lib/cooked_post_processor.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/cooked_post_processor.rb b/lib/cooked_post_processor.rb index 5989891dd..ea35cafc7 100644 --- a/lib/cooked_post_processor.rb +++ b/lib/cooked_post_processor.rb @@ -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