In remove_remote, exclude removed media attachments. (#5626)

remotes/1727458204337373841/tmp_refs/heads/signup-info-prompt
Naoki Kosaka 2017-11-08 23:19:22 +09:00 committed by Eugen Rochko
parent 64cc129225
commit 4c0a85ef9b
1 changed files with 1 additions and 1 deletions

View File

@ -81,7 +81,7 @@ namespace :mastodon do
task remove_remote: :environment do task remove_remote: :environment 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('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 media.file.destroy
media.save media.save
end end