added setting option for wiki history compression (none or gzip)

git-svn-id: http://redmine.rubyforge.org/svn/branches/work@292 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2007-03-04 14:20:48 +00:00
parent 74bfe8b9e5
commit 0f419dd028
4 changed files with 18 additions and 5 deletions
+12 -5
View File
@@ -28,11 +28,18 @@ class WikiContent < ActiveRecord::Base
attr_protected :data
def text=(plain)
gz = Zlib::GzipWriter.new(compressed = StringIO.new)
gz.write(plain)
gz.close
self.data = compressed.string
self.compression = 'gzip'
case Setting.wiki_compression
when 'gzip'
gz = Zlib::GzipWriter.new(compressed = StringIO.new)
gz.write(plain)
gz.close
self.data = compressed.string
self.compression = 'gzip'
else
self.data = plain
self.compression = ''
end
plain
end
def text