FEATURE: ensure posts are rebaked when missing is fixed
This ensures any corrupt optimized images are removed and re-created
This commit is contained in:
parent
bb74ccf288
commit
24fe08230f
|
@ -1092,6 +1092,16 @@ def fix_missing_s3
|
|||
# we do not fix sha, it may be wrong for arbitrary reasons, if we correct it
|
||||
# we may end up breaking posts
|
||||
upload.update!(etag: fixed_upload.etag, url: fixed_upload.url, verified: nil)
|
||||
|
||||
OptimizedImage.where(upload_id: upload.id).destroy_all
|
||||
rebake_ids = PostUpload.where(upload_id: upload.id).pluck(:post_id)
|
||||
|
||||
if rebake_ids.present?
|
||||
Post.where(id: rebake_ids).each do |post|
|
||||
puts "rebake post #{post.id}"
|
||||
post.rebake!
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue