mirror of
https://github.com/discourse/discourse.git
synced 2025-06-06 13:06:56 +08:00
Allow uploads:missing
Rake task to be run for a single site.
This commit is contained in:
@ -318,16 +318,22 @@ end
|
||||
|
||||
# list all missing uploads and optimized images
|
||||
task "uploads:missing" => :environment do
|
||||
|
||||
public_directory = "#{Rails.root}/public"
|
||||
|
||||
if ENV["RAILS_DB"]
|
||||
list_missing_uploads
|
||||
else
|
||||
RailsMultisite::ConnectionManagement.each_connection do |db|
|
||||
list_missing_uploads
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def list_missing_uploads
|
||||
if Discourse.store.external?
|
||||
puts "This task only works for internal storages."
|
||||
next
|
||||
return
|
||||
end
|
||||
|
||||
public_directory = "#{Rails.root}/public"
|
||||
|
||||
Upload.find_each do |upload|
|
||||
|
||||
@ -359,9 +365,6 @@ task "uploads:missing" => :environment do
|
||||
end
|
||||
puts path if bad
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
################################################################################
|
||||
|
Reference in New Issue
Block a user