discourse/app/models/export_csv.rb

26 lines
602 B
Ruby
Raw Normal View History

2014-08-09 06:28:57 -04:00
class ExportCsv
def self.get_download_path(filename)
path = File.join(ExportCsv.base_directory, filename)
if File.exists?(path)
return path
else
nil
end
end
2014-08-14 16:17:52 -04:00
def self.remove_old_exports
dir = Dir.new(ExportCsv.base_directory)
dir.each do |file|
if (File.mtime(File.join(ExportCsv.base_directory, file)) < 2.days.ago)
File.delete(File.join(ExportCsv.base_directory, file))
end
end
end
2014-08-09 06:28:57 -04:00
def self.base_directory
File.join(Rails.root, "public", "uploads", "csv_exports", RailsMultisite::ConnectionManagement.current_db)
end
end