rake task to regenerate avatars

This commit is contained in:
Régis Hanol 2013-09-08 12:22:50 +02:00
parent 78b1036db7
commit 3e80e885ae
2 changed files with 14 additions and 1 deletions

View File

@ -669,7 +669,7 @@ en:
username_change_period: "The number of days after registration that accounts can change their username."
allow_uploaded_avatars: "Allow users to upload their custom avatars"
allow_animated_avatars: "Allow users to use animated gif for avatars"
allow_animated_avatars: "Allow users to use animated gif for avatars. WARNING: it is highly recommended to run the avatars:regenerate rake task after changing that setting."
default_digest_email_frequency: "How often users receive digest emails by default. They can change this setting in their preferences."
notification_types:

13
lib/tasks/avatars.rake Normal file
View File

@ -0,0 +1,13 @@
desc "re-generate avatars"
task "avatars:regenerate" => :environment do
RailsMultisite::ConnectionManagement.each_connection do |db|
puts "Generating avatars for: #{db}"
User.select(:uploaded_avatar_id).where("uploaded_avatar_id IS NOT NULL").all.each do |u|
Jobs.enqueue(:generate_avatars, upload_id: u.uploaded_avatar_id)
putc "."
end
end
puts "\ndone."
end