Skip to content

Commit

Permalink
Merge pull request discourse#1420 from ZogStriP/rake-task-to-regenera…
Browse files Browse the repository at this point in the history
…te-avatars

rake task to regenerate avatars
  • Loading branch information
eviltrout committed Sep 9, 2013
2 parents 0523e8c + 3e80e88 commit d00e0cb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion config/locales/server.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
13 changes: 13 additions & 0 deletions lib/tasks/avatars.rake
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit d00e0cb

Please sign in to comment.