remove references to ssd previews
This commit is contained in:
@@ -43,21 +43,18 @@ class Post < ActiveRecord::Base
|
|||||||
def distribute_files
|
def distribute_files
|
||||||
RemoteFileManager.new(file_path).distribute
|
RemoteFileManager.new(file_path).distribute
|
||||||
RemoteFileManager.new(real_preview_file_path).distribute if is_image?
|
RemoteFileManager.new(real_preview_file_path).distribute if is_image?
|
||||||
RemoteFileManager.new(ssd_preview_file_path).distribute if Danbooru.config.ssd_path && is_image?
|
|
||||||
RemoteFileManager.new(large_file_path).distribute if has_large?
|
RemoteFileManager.new(large_file_path).distribute if has_large?
|
||||||
end
|
end
|
||||||
|
|
||||||
def delete_remote_files
|
def delete_remote_files
|
||||||
RemoteFileManager.new(file_path).delete
|
RemoteFileManager.new(file_path).delete
|
||||||
RemoteFileManager.new(real_preview_file_path).delete if is_image?
|
RemoteFileManager.new(real_preview_file_path).delete if is_image?
|
||||||
RemoteFileManager.new(ssd_preview_file_path).delete if Danbooru.config.ssd_path && is_image?
|
|
||||||
RemoteFileManager.new(large_file_path).delete if has_large?
|
RemoteFileManager.new(large_file_path).delete if has_large?
|
||||||
end
|
end
|
||||||
|
|
||||||
def delete_files
|
def delete_files
|
||||||
FileUtils.rm_f(file_path)
|
FileUtils.rm_f(file_path)
|
||||||
FileUtils.rm_f(large_file_path)
|
FileUtils.rm_f(large_file_path)
|
||||||
FileUtils.rm_f(ssd_preview_file_path) if Danbooru.config.ssd_path
|
|
||||||
FileUtils.rm_f(real_preview_file_path)
|
FileUtils.rm_f(real_preview_file_path)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -77,20 +74,8 @@ class Post < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def real_preview_file_path
|
|
||||||
"#{Rails.root}/public/data/preview/#{file_path_prefix}#{md5}.jpg"
|
|
||||||
end
|
|
||||||
|
|
||||||
def ssd_preview_file_path
|
|
||||||
"#{Danbooru.config.ssd_path}/public/data/preview/#{file_path_prefix}#{md5}.jpg"
|
|
||||||
end
|
|
||||||
|
|
||||||
def preview_file_path
|
def preview_file_path
|
||||||
if Danbooru.config.ssd_path
|
"#{Rails.root}/public/data/preview/#{file_path_prefix}#{md5}.jpg"
|
||||||
ssd_preview_file_path
|
|
||||||
else
|
|
||||||
real_preview_file_path
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def file_url
|
def file_url
|
||||||
@@ -110,11 +95,7 @@ class Post < ActiveRecord::Base
|
|||||||
return "/images/download-preview.png"
|
return "/images/download-preview.png"
|
||||||
end
|
end
|
||||||
|
|
||||||
if Danbooru.config.ssd_path
|
"/data/preview/#{file_path_prefix}#{md5}.jpg"
|
||||||
"/ssd/data/preview/#{file_path_prefix}#{md5}.jpg"
|
|
||||||
else
|
|
||||||
"/data/preview/#{file_path_prefix}#{md5}.jpg"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def file_url_for(user)
|
def file_url_for(user)
|
||||||
|
|||||||
@@ -155,10 +155,6 @@ class Upload < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
Danbooru.resize(source_path, resized_file_path_for(width), width, height, quality)
|
Danbooru.resize(source_path, resized_file_path_for(width), width, height, quality)
|
||||||
|
|
||||||
if width == Danbooru.config.small_image_width && Danbooru.config.ssd_path
|
|
||||||
Danbooru.resize(source_path, ssd_file_path, width, height, quality)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -228,11 +224,6 @@ class Upload < ActiveRecord::Base
|
|||||||
"#{Rails.root}/public/data/#{prefix}#{md5}.#{file_ext}"
|
"#{Rails.root}/public/data/#{prefix}#{md5}.#{file_ext}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def ssd_file_path
|
|
||||||
prefix = Rails.env == "test" ? "test." : ""
|
|
||||||
"#{Danbooru.config.ssd_path}/public/data/preview/#{prefix}#{md5}.jpg"
|
|
||||||
end
|
|
||||||
|
|
||||||
def resized_file_path_for(width)
|
def resized_file_path_for(width)
|
||||||
prefix = Rails.env == "test" ? "test." : ""
|
prefix = Rails.env == "test" ? "test." : ""
|
||||||
|
|
||||||
|
|||||||
@@ -82,11 +82,6 @@ module Danbooru
|
|||||||
300
|
300
|
||||||
end
|
end
|
||||||
|
|
||||||
# If a solid state drive is availble, cache the thumbnails on the SSD to reduce disk seek times.
|
|
||||||
def ssd_path
|
|
||||||
nil
|
|
||||||
end
|
|
||||||
|
|
||||||
# Where the ad banners are stored in the file system
|
# Where the ad banners are stored in the file system
|
||||||
def advertisement_path
|
def advertisement_path
|
||||||
nil
|
nil
|
||||||
|
|||||||
@@ -68,9 +68,6 @@ namespace :data do
|
|||||||
run "rm -f #{release_path}/public/data"
|
run "rm -f #{release_path}/public/data"
|
||||||
run "ln -s #{deploy_to}/shared/data #{release_path}/public/data"
|
run "ln -s #{deploy_to}/shared/data #{release_path}/public/data"
|
||||||
|
|
||||||
run "rm -f #{release_path}/public/ssd"
|
|
||||||
run "ln -s /mnt/ssd#{deploy_to}/current/public #{release_path}/public/ssd"
|
|
||||||
|
|
||||||
run "rm -f #{release_path}/public/images/advertisements"
|
run "rm -f #{release_path}/public/images/advertisements"
|
||||||
run "ln -s #{deploy_to}/shared/advertisements #{release_path}/public/images/advertisements"
|
run "ln -s #{deploy_to}/shared/advertisements #{release_path}/public/images/advertisements"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user