aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/application_controller.rb2
-rw-r--r--app/controllers/services_controller.rb10
-rw-r--r--app/models/raw_email.rb26
3 files changed, 5 insertions, 33 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index d3ea7493b..8fc6c3792 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -197,10 +197,12 @@ class ApplicationController < ActionController::Base
return File.exists?(key_path)
end
def foi_fragment_cache_read(key_path)
+ logger.info "Reading from fragment cache #{key_path}"
return File.read(key_path)
end
def foi_fragment_cache_write(key_path, content)
FileUtils.mkdir_p(File.dirname(key_path))
+ logger.info "Writing to fragment cache #{key_path}"
File.atomic_write(key_path) do |f|
f.write(content)
end
diff --git a/app/controllers/services_controller.rb b/app/controllers/services_controller.rb
index 6fb20336e..225790d71 100644
--- a/app/controllers/services_controller.rb
+++ b/app/controllers/services_controller.rb
@@ -1,12 +1,4 @@
-# controllers/application.rb:
-# Parent class of all controllers in FOI site. Filters added to this controller
-# apply to all controllers in the application. Likewise, all the methods added
-# will be available for all controllers.
-#
-# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
-#
-# $Id: application.rb,v 1.59 2009-09-17 13:01:56 francis Exp $
+# controllers/services_controller.rb:
require 'open-uri'
diff --git a/app/models/raw_email.rb b/app/models/raw_email.rb
index 6e073aa27..3e12a6feb 100644
--- a/app/models/raw_email.rb
+++ b/app/models/raw_email.rb
@@ -27,7 +27,7 @@ class RawEmail < ActiveRecord::Base
def directory
request_id = self.incoming_message.info_request.id.to_s
if ENV["RAILS_ENV"] == "test"
- return 'files/raw_email_test'
+ return File.join(RAILS_ROOT, 'files/raw_email_test')
else
return File.join(MySociety::Config.get('RAW_EMAILS_LOCATION',
'files/raw_emails'),
@@ -49,35 +49,13 @@ class RawEmail < ActiveRecord::Base
end
def data
- if !File.exists?(self.filepath)
- dbdata
- else
- File.open(self.filepath, "rb" ).read
- end
+ File.open(self.filepath, "rb").read
end
def destroy_file_representation!
File.delete(self.filepath)
end
- def dbdata=(d)
- write_attribute(:data_binary, d)
- end
-
- def dbdata
- d = read_attribute(:data_binary)
- if !d.nil?
- return d
- end
-
- d = read_attribute(:data_text)
- if !d.nil?
- return d
- end
-
- raise "internal error, double nil value in RawEmail"
- end
-
end