Fix upload cache directory (opensimplif)

This commit is contained in:
Xavier J 2016-11-02 10:18:59 +01:00
parent 1376372c9e
commit 1ecfc62bb5
4 changed files with 18 additions and 31 deletions

View file

@ -0,0 +1,15 @@
# encoding: utf-8
class BaseUploader < CarrierWave::Uploader::Base
def cache_dir
if Rails.env.production?
if Features.opensimplif?
'/tmp/opensimplif-cache'
else
'/tmp/tps-cache'
end
else
'/tmp/tps-dev-cache'
end
end
end

View file

@ -1,6 +1,6 @@
# encoding: utf-8 # encoding: utf-8
class CerfaUploader < CarrierWave::Uploader::Base class CerfaUploader < BaseUploader
before :cache, :set_original_filename before :cache, :set_original_filename
# Choose what kind of storage to use for this uploader: # Choose what kind of storage to use for this uploader:
@ -18,14 +18,6 @@ class CerfaUploader < CarrierWave::Uploader::Base
end end
end end
def cache_dir
if Rails.env.production?
'/tmp/tps-cache'
else
'/tmp/tps-dev-cache'
end
end
# Add a white list of extensions which are allowed to be uploaded. # Add a white list of extensions which are allowed to be uploaded.
# For images you might use something like this: # For images you might use something like this:
def extension_white_list def extension_white_list

View file

@ -1,6 +1,6 @@
# encoding: utf-8 # encoding: utf-8
class PieceJustificativeUploader < CarrierWave::Uploader::Base class PieceJustificativeUploader < BaseUploader
before :cache, :set_original_filename before :cache, :set_original_filename
# Choose what kind of storage to use for this uploader: # Choose what kind of storage to use for this uploader:
@ -18,18 +18,6 @@ class PieceJustificativeUploader < CarrierWave::Uploader::Base
end end
end end
def cache_dir
if Rails.env.production?
if Features.opensimplif?
'/tmp/opensimplif-cache'
else
'/tmp/tps-cache'
end
else
'/tmp/tps-dev-cache'
end
end
# Add a white list of extensions which are allowed to be uploaded. # Add a white list of extensions which are allowed to be uploaded.
# For images you might use something like this: # For images you might use something like this:
def extension_white_list def extension_white_list

View file

@ -1,6 +1,6 @@
# encoding: utf-8 # encoding: utf-8
class ProcedureLogoUploader < CarrierWave::Uploader::Base class ProcedureLogoUploader < BaseUploader
def root def root
File.join(Rails.root, "public") File.join(Rails.root, "public")
@ -21,14 +21,6 @@ class ProcedureLogoUploader < CarrierWave::Uploader::Base
end end
end end
def cache_dir
if Rails.env.production?
'/tmp/tps-cache'
else
'/tmp/tps-dev-cache'
end
end
# Add a white list of extensions which are allowed to be uploaded. # Add a white list of extensions which are allowed to be uploaded.
# For images you might use something like this: # For images you might use something like this:
def extension_white_list def extension_white_list