Added max_upload_size to the FileYard constructor
This commit is contained in:
parent
06e806fe30
commit
217dbdafdc
3 changed files with 4 additions and 3 deletions
|
@ -5,8 +5,9 @@ class FileYard
|
||||||
|
|
||||||
attr_reader :files_path
|
attr_reader :files_path
|
||||||
|
|
||||||
def initialize(files_path)
|
def initialize(files_path, max_upload_size)
|
||||||
@files_path = files_path
|
@files_path = files_path
|
||||||
|
@max_upload_size = max_upload_size
|
||||||
FileUtils.mkdir_p(files_path) unless File.exist?(files_path)
|
FileUtils.mkdir_p(files_path) unless File.exist?(files_path)
|
||||||
@files = Dir["#{files_path}/*"].collect{|path| File.basename(path) if File.file?(path) }.compact
|
@files = Dir["#{files_path}/*"].collect{|path| File.basename(path) if File.file?(path) }.compact
|
||||||
end
|
end
|
||||||
|
|
|
@ -29,7 +29,7 @@ module AbstractWikiService
|
||||||
def file_yard(web)
|
def file_yard(web)
|
||||||
raise "Web #{@web.name} does not belong to this wiki service" unless @webs.values.include?(web)
|
raise "Web #{@web.name} does not belong to this wiki service" unless @webs.values.include?(web)
|
||||||
# TODO cache FileYards
|
# TODO cache FileYards
|
||||||
FileYard.new("#{self.storage_path}/#{web.address}")
|
FileYard.new("#{self.storage_path}/#{web.address}", web.max_upload_size)
|
||||||
end
|
end
|
||||||
|
|
||||||
def init_wiki_service
|
def init_wiki_service
|
||||||
|
|
|
@ -10,7 +10,7 @@ class FileYardTest < Test::Unit::TestCase
|
||||||
def setup
|
def setup
|
||||||
FileUtils.mkdir_p(file_path)
|
FileUtils.mkdir_p(file_path)
|
||||||
FileUtils.rm(Dir["#{file_path}/*"])
|
FileUtils.rm(Dir["#{file_path}/*"])
|
||||||
@yard = FileYard.new(file_path)
|
@yard = FileYard.new(file_path, 100)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_files
|
def test_files
|
||||||
|
|
Loading…
Reference in a new issue