DEV: Allow all uploads when fixing missing s3

If we do not do this we can not properly re-download files
This commit is contained in:
Sam Saffron 2020-08-28 12:28:41 +10:00
parent 159762dbd0
commit ed9323043f
No known key found for this signature in database
GPG Key ID: B9606168D2FFD9F5
1 changed files with 11 additions and 3 deletions

View File

@ -1138,7 +1138,7 @@ def fix_missing_s3
end
if fix_error
puts "Failed to fix upload #{e}"
puts "Failed to fix upload #{fix_error}"
else
# we do not fix sha, it may be wrong for arbitrary reasons, if we correct it
# we may end up breaking posts
@ -1181,12 +1181,20 @@ def fix_missing_s3
puts
end
def allow_all_uploads
old_staff_extension = SiteSetting.authorized_extensions_for_staff
SiteSetting.authorized_extensions_for_staff = "*"
yield
ensure
SiteSetting.authorized_extensions_for_staff = old_staff_extension
end
task "uploads:fix_missing_s3" => :environment do
if RailsMultisite::ConnectionManagement.current_db != "default"
fix_missing_s3
allow_all_uploads { fix_missing_s3 }
else
RailsMultisite::ConnectionManagement.each_connection do
fix_missing_s3
allow_all_uploads { fix_missing_s3 }
end
end
end