DEV: Report the missing uploads count
This commit is contained in:
parent
01dc0abb05
commit
1a9a2bd5c1
|
@ -411,6 +411,7 @@ def list_missing_uploads(skip_optimized: false)
|
||||||
|
|
||||||
public_directory = "#{Rails.root}/public"
|
public_directory = "#{Rails.root}/public"
|
||||||
|
|
||||||
|
count = 0
|
||||||
Upload.find_each do |upload|
|
Upload.find_each do |upload|
|
||||||
|
|
||||||
# could be a remote image
|
# could be a remote image
|
||||||
|
@ -423,10 +424,15 @@ def list_missing_uploads(skip_optimized: false)
|
||||||
rescue
|
rescue
|
||||||
# something is messed up
|
# something is messed up
|
||||||
end
|
end
|
||||||
puts path if bad
|
if bad
|
||||||
|
count += 1
|
||||||
|
puts path
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
puts "Missing uploads: #{count}/#{Upload.count}" if count > 0
|
||||||
|
|
||||||
unless skip_optimized
|
unless skip_optimized
|
||||||
|
count = 0
|
||||||
OptimizedImage.find_each do |optimized_image|
|
OptimizedImage.find_each do |optimized_image|
|
||||||
# remote?
|
# remote?
|
||||||
next unless optimized_image.url =~ /^\/[^\/]/
|
next unless optimized_image.url =~ /^\/[^\/]/
|
||||||
|
@ -439,8 +445,12 @@ def list_missing_uploads(skip_optimized: false)
|
||||||
rescue
|
rescue
|
||||||
# something is messed up
|
# something is messed up
|
||||||
end
|
end
|
||||||
puts path if bad
|
if bad
|
||||||
|
count += 1
|
||||||
|
puts path
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
puts "Missing optimized images: #{count}/#{OptimizedImage.count}" if count > 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue