1
0
mirror of https://github.com/mastodon/mastodon synced 2024-11-28 06:48:28 +09:00
This commit is contained in:
Thomas Leister 2018-03-01 23:30:06 +01:00 committed by Eugen Rochko
parent 64f2ada5d4
commit ecd36c1ede

View File

@ -476,8 +476,10 @@ namespace :mastodon do
time_ago = ENV.fetch('NUM_DAYS') { 7 }.to_i.days.ago time_ago = ENV.fetch('NUM_DAYS') { 7 }.to_i.days.ago
MediaAttachment.where.not(remote_url: '').where.not(file_file_name: nil).where('created_at < ?', time_ago).find_each do |media| MediaAttachment.where.not(remote_url: '').where.not(file_file_name: nil).where('created_at < ?', time_ago).find_each do |media|
media.file.destroy if media.file.exists?
media.save media.file.destroy
media.save
end
end end
end end