aboutsummaryrefslogtreecommitdiffstats
path: root/lib/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tasks')
-rw-r--r--lib/tasks/temp.rake22
-rw-r--r--lib/tasks/themes.rake12
-rw-r--r--lib/tasks/translation.rake12
3 files changed, 34 insertions, 12 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
diff --git a/lib/tasks/themes.rake b/lib/tasks/themes.rake
index cbd3d123e..a8d16f108 100644
--- a/lib/tasks/themes.rake
+++ b/lib/tasks/themes.rake
@@ -9,15 +9,17 @@ namespace :themes do
File.join(plugin_dir, theme_name)
end
+ def checkout(commitish)
+ puts "Checking out #{commitish}" if verbose
+ system "git checkout #{commitish}"
+ end
+
def checkout_tag(version)
- checkout_command = "git checkout #{usage_tag(version)}"
- success = system(checkout_command)
- puts "Using tag #{usage_tag(version)}" if verbose && success
- success
+ checkout usage_tag(version)
end
def checkout_remote_branch(branch)
- system("git checkout origin/#{branch}")
+ checkout "origin/#{branch}"
end
def usage_tag(version)
diff --git a/lib/tasks/translation.rake b/lib/tasks/translation.rake
index 351faef2c..6458d9268 100644
--- a/lib/tasks/translation.rake
+++ b/lib/tasks/translation.rake
@@ -142,13 +142,11 @@ namespace :translation do
output_file)
# track mailer
- xapian_object = InfoRequest.full_search([InfoRequestEvent],
- track_thing.track_query,
- 'described_at',
- true,
- nil,
- 100,
- 1)
+ xapian_object = ActsAsXapian::Search.new([InfoRequestEvent], track_thing.track_query,
+ :sort_by_prefix => 'described_at',
+ :sort_by_ascending => true,
+ :collapse_by_prefix => nil,
+ :limit => 100)
event_digest_email = TrackMailer.event_digest(info_request.user,
[[track_thing,
xapian_object.results,