FIX: undefined method 'max_file_size_kb'

This commit is contained in:
Régis Hanol 2015-05-26 16:39:41 +02:00
parent 9cd6b91b6d
commit a5d93c6705
3 changed files with 4 additions and 6 deletions

View File

@ -93,10 +93,6 @@ class SiteSetting < ActiveRecord::Base
use_https? ? "https" : "http"
end
def max_file_size_kb
[SiteSetting.max_image_size_kb, SiteSetting.max_attachment_size_kb].max.kilobytes
end
def self.has_enough_topics_to_redirect_to_top
TopTopic.periods.each do |period|
topics_per_period = TopTopic.where("#{period}_score > 0")

View File

@ -58,8 +58,9 @@ module FileStore
file = get_from_cache(filename)
if !file
max_file_size_kb = [SiteSetting.max_image_size_kb, SiteSetting.max_attachment_size_kb].max.kilobytes
url = SiteSetting.scheme + ":" + upload.url
file = FileHelper.download(url, SiteSetting.max_file_size_kb, "discourse-s3", true)
file = FileHelper.download(url, max_file_size_kb, "discourse-s3", true)
cache_file(file, filename)
end

View File

@ -31,6 +31,7 @@ task "uploads:migrate_from_s3" => :environment do
require "file_store/local_store"
require "file_helper"
max_file_size_kb = [SiteSetting.max_image_size_kb, SiteSetting.max_attachment_size_kb].max.kilobytes
local_store = FileStore::LocalStore.new
puts "Deleting all optimized images..."
@ -62,7 +63,7 @@ task "uploads:migrate_from_s3" => :environment do
# fix the name of pasted images
upload.original_filename = "blob.png" if upload.original_filename == "blob"
# download the file (in a temp file)
temp_file = FileHelper.download("http:" + previous_url, SiteSetting.max_file_size_kb, "from_s3")
temp_file = FileHelper.download("http:" + previous_url, max_file_size_kb, "from_s3")
# store the file locally
upload.url = local_store.store_upload(temp_file, upload)
# save the new url