mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Improvements for uploads:disable_secure_uploads task (#31231)
This commit contains a couple of improvements for this rake task. * We no longer limit the uploads to only ones with Post upload references, it doesn't matter what the secure uploads are linked to, they should all be un-secured * We now only get distinct uploads from the initial query, multiple upload references on the same upload caused double ups and confusing counts for the task * We now also disable the secure_uploads_pm_only site setting at the same time
This commit is contained in:
@@ -597,13 +597,9 @@ task "uploads:disable_secure_uploads" => :environment do
|
||||
puts "Disabling secure upload and resetting uploads to not secure in #{db}...", ""
|
||||
|
||||
SiteSetting.secure_uploads = false
|
||||
SiteSetting.secure_uploads_pm_only = false
|
||||
|
||||
secure_uploads =
|
||||
Upload
|
||||
.joins(:upload_references)
|
||||
.where(upload_references: { target_type: "Post" })
|
||||
.where(secure: true)
|
||||
|
||||
secure_uploads = Upload.where(secure: true).distinct
|
||||
secure_upload_count = secure_uploads.count
|
||||
|
||||
puts "", "Marking #{secure_upload_count} uploads as not secure.", ""
|
||||
|
Reference in New Issue
Block a user