aboutsummaryrefslogtreecommitdiffstats
path: root/script
diff options
context:
space:
mode:
Diffstat (limited to 'script')
-rwxr-xr-xscript/about2
-rwxr-xr-xscript/breakpointer2
-rw-r--r--script/cache-incoming-emails9
-rwxr-xr-xscript/clear-caches2
-rwxr-xr-xscript/console2
-rwxr-xr-xscript/destroy2
-rwxr-xr-xscript/fill-database-caches11
-rwxr-xr-xscript/generate2
-rwxr-xr-xscript/handle-mail-replies21
-rwxr-xr-xscript/performance/benchmarker2
-rwxr-xr-xscript/performance/profiler2
-rwxr-xr-xscript/plugin2
-rwxr-xr-xscript/process/inspector2
-rwxr-xr-xscript/process/reaper2
-rwxr-xr-xscript/process/spawner2
-rwxr-xr-xscript/runner2
-rwxr-xr-xscript/server2
-rwxr-xr-xscript/wraptest2
18 files changed, 30 insertions, 41 deletions
diff --git a/script/about b/script/about
index 746e44659..f2b98742d 100755
--- a/script/about
+++ b/script/about
@@ -1,5 +1,3 @@
-#!/usr/bin/ruby
-
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot.rb'
require 'commands/about'
diff --git a/script/breakpointer b/script/breakpointer
index dfe58bf36..609564148 100755
--- a/script/breakpointer
+++ b/script/breakpointer
@@ -1,5 +1,3 @@
-#!/usr/bin/ruby
-
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot.rb'
require 'commands/breakpointer'
diff --git a/script/cache-incoming-emails b/script/cache-incoming-emails
new file mode 100644
index 000000000..a84a713d6
--- /dev/null
+++ b/script/cache-incoming-emails
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+# Fill in all the database caches of text from body/attachments.
+# Will take a while to run! Can use after clear-caches to refresh the database
+# level caches if you like.
+
+LOC=`dirname $0`
+
+"$LOC/runner" 'IncomingMessage.find_each() { |im| print "info request " + im.info_request.id.to_s + ", incoming message " + im.id.to_s + ": " + im.extract_attachments!.count.to_s + " attachments extracted to " + im.foi_attachments[0].directory + "; main body folded: " + im.get_main_body_text_folded.size.to_s + " attachment clipped:" + im.get_attachment_text_clipped.size.to_s + "\n" }'
diff --git a/script/clear-caches b/script/clear-caches
index e9438f92d..be1d3d017 100755
--- a/script/clear-caches
+++ b/script/clear-caches
@@ -4,7 +4,7 @@
LOC=`dirname $0`
-"$LOC/runner" "ActiveRecord::Base.connection.execute(\"update incoming_messages set cached_attachment_text_clipped = null, cached_main_body_text_unfolded = null, cached_main_body_text_folded = null\")"
+"$LOC/runner" "ActiveRecord::Base.connection.execute(\"update incoming_messages set cached_attachment_text_clipped = null, cached_main_body_text_unfolded = null, cached_main_body_text_folded = null, sent_at = null, subject = null, mail_from = null, mail_from_domain = null, valid_to_reply_to = null, last_parsed = null\")"
# Remove page cache (do it in two stages so live site gets cache cleared faster)
rm -fr $LOC/../old-cache
diff --git a/script/console b/script/console
index 98f6702bb..83386647f 100755
--- a/script/console
+++ b/script/console
@@ -1,5 +1,3 @@
-#!/usr/bin/ruby
-
#!/usr/bin/env ruby
require File.expand_path(File.dirname(__FILE__) + '/../config/boot.rb')
require 'commands/console'
diff --git a/script/destroy b/script/destroy
index 937962908..e63ac0ef5 100755
--- a/script/destroy
+++ b/script/destroy
@@ -1,5 +1,3 @@
-#!/usr/bin/ruby
-
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot.rb'
require 'commands/destroy'
diff --git a/script/fill-database-caches b/script/fill-database-caches
deleted file mode 100755
index e6b525144..000000000
--- a/script/fill-database-caches
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/bash
-
-# Fill in all the database caches of text from body/attachments.
-# Will take a while to run! Can use after clear-caches to refresh the database
-# level caches if you like.
-
-LOC=`dirname $0`
-
-"$LOC/runner" 'IncomingMessage.find_each() { |im| print im.id.to_s + " id: main body folded:" + im.get_main_body_text_folded.size.to_s + " attachment clipped:" + im.get_attachment_text_clipped.size.to_s + "\n" }'
-
-
diff --git a/script/generate b/script/generate
index a765ddcd4..8c0486a09 100755
--- a/script/generate
+++ b/script/generate
@@ -1,5 +1,3 @@
-#!/usr/bin/ruby
-
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot.rb'
require 'commands/generate'
diff --git a/script/handle-mail-replies b/script/handle-mail-replies
index 9b1fb5b29..68cab9035 100755
--- a/script/handle-mail-replies
+++ b/script/handle-mail-replies
@@ -1,4 +1,5 @@
-#!/usr/bin/ruby
+#!/usr/bin/env ruby
+# -*- coding: utf-8 -*-
# Handle email responses sent to us.
#
@@ -17,8 +18,13 @@ load "config.rb"
MySociety::Config.set_file(File.join($alaveteli_dir, 'config', 'general'), true)
MySociety::Config.load_default
-$:.push(File.join($alaveteli_dir, "vendor", "rails", "actionmailer", "lib", "action_mailer", "vendor", "tmail-1.2.7"))
-require 'tmail'
+require 'rubygems'
+if File.exist? File.join($alaveteli_dir,'vendor','rails','Rakefile')
+ $:.push(File.join($alaveteli_dir, "vendor", "rails", "actionmailer", "lib", "action_mailer", "vendor", "tmail-1.2.7"))
+ require 'tmail'
+else
+ require 'action_mailer'
+end
def main(in_test_mode)
Dir.chdir($alaveteli_dir) do
@@ -114,12 +120,21 @@ def is_oof?(message)
end
end
+ if message.header_string("Auto-Submitted") == "auto-generated"
+ if subject =~ /out of( the)? office/
+ return true
+ end
+ end
+
if subject.start_with? "out of office autoreply:"
return true
end
if subject == "out of office"
return true
end
+ if subject == "out of office reply"
+ return true
+ end
if subject.end_with? "is out of the office"
return true
end
diff --git a/script/performance/benchmarker b/script/performance/benchmarker
index c2441c941..a94253aba 100755
--- a/script/performance/benchmarker
+++ b/script/performance/benchmarker
@@ -1,5 +1,3 @@
-#!/usr/bin/ruby
-
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot.rb'
require 'commands/performance/benchmarker'
diff --git a/script/performance/profiler b/script/performance/profiler
index a7ea37a9a..e9e5b071d 100755
--- a/script/performance/profiler
+++ b/script/performance/profiler
@@ -1,5 +1,3 @@
-#!/usr/bin/ruby
-
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot.rb'
require 'commands/performance/profiler'
diff --git a/script/plugin b/script/plugin
index bcc697802..18ae72620 100755
--- a/script/plugin
+++ b/script/plugin
@@ -1,5 +1,3 @@
-#!/usr/bin/ruby
-
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot.rb'
require 'commands/plugin'
diff --git a/script/process/inspector b/script/process/inspector
index 261317109..696551c6b 100755
--- a/script/process/inspector
+++ b/script/process/inspector
@@ -1,5 +1,3 @@
-#!/usr/bin/ruby
-
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot.rb'
require 'commands/process/inspector'
diff --git a/script/process/reaper b/script/process/reaper
index 309764a0d..a03da9387 100755
--- a/script/process/reaper
+++ b/script/process/reaper
@@ -1,5 +1,3 @@
-#!/usr/bin/ruby
-
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot.rb'
require 'commands/process/reaper'
diff --git a/script/process/spawner b/script/process/spawner
index 2768db7fd..6852fba27 100755
--- a/script/process/spawner
+++ b/script/process/spawner
@@ -1,5 +1,3 @@
-#!/usr/bin/ruby
-
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot.rb'
require 'commands/process/spawner'
diff --git a/script/runner b/script/runner
index 5a5254c47..6b0bc0a08 100755
--- a/script/runner
+++ b/script/runner
@@ -1,4 +1,4 @@
-#!/usr/bin/ruby
+#!/usr/bin/env ruby
daemon_mode = !ARGV.empty? && ARGV[0] == "--daemon"
diff --git a/script/server b/script/server
index 9c6088a88..dc3edabd5 100755
--- a/script/server
+++ b/script/server
@@ -1,5 +1,3 @@
-#!/usr/bin/ruby
-
#!/usr/bin/env ruby
require File.expand_path(File.dirname(__FILE__) + '/../config/boot.rb')
require 'commands/server'
diff --git a/script/wraptest b/script/wraptest
index d62e4ce48..780c9b4a2 100755
--- a/script/wraptest
+++ b/script/wraptest
@@ -1,4 +1,4 @@
-#!/usr/bin/ruby
+#!/usr/bin/env ruby
#
# wraptest:
# Test email wrapping function