diff options
author | Louise Crow <louise.crow@gmail.com> | 2013-06-26 13:05:08 -0700 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2013-06-26 13:05:08 -0700 |
commit | 27d6ad899f594bd9b79e54cdc5a3c17110f3b26c (patch) | |
tree | b75973ee4325bd11f27220e38d1e899076948c78 /lib/tasks/temp.rake | |
parent | 9bbc93bfd8ba8aaaf9bd1ad9031368b7faad8239 (diff) | |
parent | 3194a7801684d010dac94c26cf39bb780bfcd17e (diff) |
Merge branch 'release/0.12'0.12
Conflicts:
locale/he_IL/app.po
locale/hr_HR/app.po
locale/nb_NO/app.po
locale/uk/app.po
Diffstat (limited to 'lib/tasks/temp.rake')
-rw-r--r-- | lib/tasks/temp.rake | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/tasks/temp.rake b/lib/tasks/temp.rake index 35ae442c7..fcabb23de 100644 --- a/lib/tasks/temp.rake +++ b/lib/tasks/temp.rake @@ -7,6 +7,28 @@ namespace :temp do user.save! unless dryrun end + desc "Re-extract any missing cached attachments" + task :reextract_missing_attachments, [:commit] => :environment do |t, args| + dry_run = args.commit.nil? || args.commit.empty? + total_messages = 0 + messages_to_reparse = 0 + IncomingMessage.find_each :include => :foi_attachments do |im| + reparse = im.foi_attachments.any? { |fa| ! File.exists? fa.filepath } + total_messages += 1 + messages_to_reparse += 1 if reparse + if total_messages % 1000 == 0 + puts "Considered #{total_messages} received emails." + end + unless dry_run + im.parse_raw_email! true if reparse + sleep 2 + end + end + message = dry_run ? "Would reparse" : "Reparsed" + message += " #{messages_to_reparse} out of #{total_messages} received emails." + puts message + end + desc 'Cleanup accounts with a space in the email address' task :clean_up_emails_with_spaces => :environment do dryrun = ENV['DRYRUN'] == '0' ? false : true |