mirror of
https://github.com/discourse/discourse.git
synced 2025-03-21 08:45:41 +08:00
FIX: undefined method 'max_file_size_kb'
This commit is contained in:
parent
9cd6b91b6d
commit
a5d93c6705
@ -93,10 +93,6 @@ class SiteSetting < ActiveRecord::Base
|
|||||||
use_https? ? "https" : "http"
|
use_https? ? "https" : "http"
|
||||||
end
|
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
|
def self.has_enough_topics_to_redirect_to_top
|
||||||
TopTopic.periods.each do |period|
|
TopTopic.periods.each do |period|
|
||||||
topics_per_period = TopTopic.where("#{period}_score > 0")
|
topics_per_period = TopTopic.where("#{period}_score > 0")
|
||||||
|
@ -58,8 +58,9 @@ module FileStore
|
|||||||
file = get_from_cache(filename)
|
file = get_from_cache(filename)
|
||||||
|
|
||||||
if !file
|
if !file
|
||||||
|
max_file_size_kb = [SiteSetting.max_image_size_kb, SiteSetting.max_attachment_size_kb].max.kilobytes
|
||||||
url = SiteSetting.scheme + ":" + upload.url
|
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)
|
cache_file(file, filename)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@ task "uploads:migrate_from_s3" => :environment do
|
|||||||
require "file_store/local_store"
|
require "file_store/local_store"
|
||||||
require "file_helper"
|
require "file_helper"
|
||||||
|
|
||||||
|
max_file_size_kb = [SiteSetting.max_image_size_kb, SiteSetting.max_attachment_size_kb].max.kilobytes
|
||||||
local_store = FileStore::LocalStore.new
|
local_store = FileStore::LocalStore.new
|
||||||
|
|
||||||
puts "Deleting all optimized images..."
|
puts "Deleting all optimized images..."
|
||||||
@ -62,7 +63,7 @@ task "uploads:migrate_from_s3" => :environment do
|
|||||||
# fix the name of pasted images
|
# fix the name of pasted images
|
||||||
upload.original_filename = "blob.png" if upload.original_filename == "blob"
|
upload.original_filename = "blob.png" if upload.original_filename == "blob"
|
||||||
# download the file (in a temp file)
|
# 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
|
# store the file locally
|
||||||
upload.url = local_store.store_upload(temp_file, upload)
|
upload.url = local_store.store_upload(temp_file, upload)
|
||||||
# save the new url
|
# save the new url
|
||||||
|
Loading…
x
Reference in New Issue
Block a user