Added max_upload_size to the FileYard constructor

This commit is contained in:
Alexey Verkhovsky 2005-02-21 13:36:53 +00:00
parent 06e806fe30
commit 217dbdafdc
3 changed files with 4 additions and 3 deletions

View file

@ -5,8 +5,9 @@ class FileYard
attr_reader :files_path
def initialize(files_path)
def initialize(files_path, max_upload_size)
@files_path = files_path
@max_upload_size = max_upload_size
FileUtils.mkdir_p(files_path) unless File.exist?(files_path)
@files = Dir["#{files_path}/*"].collect{|path| File.basename(path) if File.file?(path) }.compact
end

View file

@ -29,7 +29,7 @@ module AbstractWikiService
def file_yard(web)
raise "Web #{@web.name} does not belong to this wiki service" unless @webs.values.include?(web)
# TODO cache FileYards
FileYard.new("#{self.storage_path}/#{web.address}")
FileYard.new("#{self.storage_path}/#{web.address}", web.max_upload_size)
end
def init_wiki_service

View file

@ -10,7 +10,7 @@ class FileYardTest < Test::Unit::TestCase
def setup
FileUtils.mkdir_p(file_path)
FileUtils.rm(Dir["#{file_path}/*"])
@yard = FileYard.new(file_path)
@yard = FileYard.new(file_path, 100)
end
def test_files