2
0
mirror of https://github.com/moebooru/moebooru synced 2025-08-22 18:07:25 +00:00
moebooru/lib/tasks/check_missing.rake
edogawaconan 83f6ad3a6e Update to 4.2.
- backport javascript functions.
- remove deprecation message from backported functions.
- fix queries and syntaxes.
- remove unused performance tester.
- update config settings to match 4.2.
- reflections is now string, not symbol.
- split off (/index) routes. For some reason it is always added now.
- DMailer is now plain ruby class.
- properly test xhr thingy.
- remove hooves
2014-12-23 03:15:06 +09:00

13 lines
440 B
Ruby

desc "find if there's any posts missing on file system"
task :find_posts => :environment do
images_path = "#{Rails.root}/public/data/image/"
Post.find(:all, :conditions => ["status != 'deleted'"], :order => "id DESC").each do |post|
md5 = post.md5
ext = post.file_ext
path = "#{images_path}/#{md5[0..1]}/#{md5[2..3]}"
file_name = "#{path}/#{md5}.#{ext}"
puts "#{md5}.#{ext}" unless File.exist?(file_name)
end
end