aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/info_request.rb
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2014-09-04 11:42:29 +0100
committerLouise Crow <louise.crow@gmail.com>2014-09-04 11:42:29 +0100
commit9389a3fe34457d63e2e34772bb0b244bbd4469b1 (patch)
tree7179d796fd11b62e6db8f16510ba04f2d59bd264 /app/models/info_request.rb
parentb53cde9ff491f950fb7fa6904549bfc819144b46 (diff)
Fix for purging of cache for non-default locales0.12.0.5hotfix/0.12.0.5
Diffstat (limited to 'app/models/info_request.rb')
-rw-r--r--app/models/info_request.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index 46c247fa9..f6c377639 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -965,6 +965,24 @@ public
find(:all, params)
end
+ def foi_fragment_cache_directories
+ # return stub path so admin can expire it
+ directories = []
+ path = File.join("request", request_dirs)
+ foi_cache_path = File.expand_path(File.join(Rails.root, 'cache', 'views'))
+ directories << File.join(foi_cache_path, path)
+ I18n.available_locales.each do |locale|
+ directories << File.join(foi_cache_path, locale.to_s, path)
+ end
+
+ directories
+ end
+
+ def request_dirs
+ first_three_digits = id.to_s()[0..2]
+ File.join(first_three_digits.to_s, id.to_s)
+ end
+
def is_old_unclassified?
!is_external? && awaiting_description && url_title != 'holding_pen' && get_last_response_event &&
Time.now > get_last_response_event.created_at + OLD_AGE_IN_DAYS