forked from treehouse/mastodon
parent
64f2ada5d4
commit
ecd36c1ede
|
@ -476,10 +476,12 @@ 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|
|
||||||
|
if media.file.exists?
|
||||||
media.file.destroy
|
media.file.destroy
|
||||||
media.save
|
media.save
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
desc 'Set unknown attachment type for remote-only attachments'
|
desc 'Set unknown attachment type for remote-only attachments'
|
||||||
task set_unknown: :environment do
|
task set_unknown: :environment do
|
||||||
|
|
Loading…
Reference in New Issue