Merge pull request #1420 from ZogStriP/rake-task-to-regenerate-avatars

rake task to regenerate avatars
This commit is contained in:
Robin Ward 2013-09-09 08:49:47 -07:00
commit d00e0cb96a
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