mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 18:43:37 +08:00
add support for multisite to the 'uploads:regenerate_missing_optimized' rake task
This commit is contained in:
parent
27a9b5ee13
commit
6d83526bf1
|
@ -209,6 +209,14 @@ end
|
||||||
|
|
||||||
# regenerate missing optimized images
|
# regenerate missing optimized images
|
||||||
task "uploads:regenerate_missing_optimized" => :environment do
|
task "uploads:regenerate_missing_optimized" => :environment do
|
||||||
|
ENV["RAILS_DB"] ? regenerate_missing_optimized : regenerate_missing_optimized_all_sites
|
||||||
|
end
|
||||||
|
|
||||||
|
def regenerate_missing_optimized_all_sites
|
||||||
|
RailsMultisite::ConnectionManagement.each_connection { regenerate_missing_optimized }
|
||||||
|
end
|
||||||
|
|
||||||
|
def regenerate_missing_optimized
|
||||||
puts "Regenerating missing optimized images for '#{RailsMultisite::ConnectionManagement.current_db}'..."
|
puts "Regenerating missing optimized images for '#{RailsMultisite::ConnectionManagement.current_db}'..."
|
||||||
|
|
||||||
if Discourse.store.external?
|
if Discourse.store.external?
|
||||||
|
@ -251,5 +259,4 @@ task "uploads:regenerate_missing_optimized" => :environment do
|
||||||
puts "Missing uploads:"
|
puts "Missing uploads:"
|
||||||
missing_uploads.sort.each { |u| puts u }
|
missing_uploads.sort.each { |u| puts u }
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user