FEATURE: move stylesheet cache out of the uploads directory

This commit is contained in:
Sam
2015-05-05 15:50:13 +10:00
parent 8e372f3616
commit f58d85edea
8 changed files with 105 additions and 6 deletions

View File

@ -3,7 +3,7 @@ require_dependency 'distributed_cache'
class DiscourseStylesheets
CACHE_PATH ||= 'uploads/stylesheet-cache'
CACHE_PATH ||= 'tmp/stylesheet-cache'
MANIFEST_DIR ||= "#{Rails.root}/tmp/cache/assets/#{Rails.env}"
MANIFEST_FULL_PATH ||= "#{MANIFEST_DIR}/stylesheet-manifest"
@ -89,6 +89,7 @@ class DiscourseStylesheets
File.open(stylesheet_fullpath, "w") do |f|
f.puts css
end
StylesheetCache.add(@target, digest, css)
css
end
@ -100,7 +101,7 @@ class DiscourseStylesheets
end
def cache_fullpath
"#{Rails.root}/public/#{CACHE_PATH}"
"#{Rails.root}/#{CACHE_PATH}"
end
def stylesheet_fullpath
@ -118,12 +119,13 @@ class DiscourseStylesheets
"#{GlobalSetting.relative_url_root}/"
end
# using uploads cause we already have all the routing in place
def stylesheet_relpath
"#{root_path}#{CACHE_PATH}/#{stylesheet_filename}"
"#{root_path}stylesheets/#{stylesheet_filename}"
end
def stylesheet_relpath_no_digest
"#{root_path}#{CACHE_PATH}/#{stylesheet_filename_no_digest}"
"#{root_path}stylesheets/#{stylesheet_filename_no_digest}"
end
def stylesheet_filename