aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/application_controller.rb
diff options
context:
space:
mode:
authorFrancis Irving <francis@mysociety.org>2010-05-18 11:04:21 +0100
committerFrancis Irving <francis@mysociety.org>2010-05-18 11:04:21 +0100
commit7064e02a0017240e6eb9cdbda02ba6ad3a97e0e3 (patch)
treed3e6ca4d89358a47805b2d0546318749fb330117 /app/controllers/application_controller.rb
parentfdb6362f7f3402cc671211909ffb8319739bf585 (diff)
Cope with 32,000 inode limit on ext3
Diffstat (limited to 'app/controllers/application_controller.rb')
-rw-r--r--app/controllers/application_controller.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index ac64bd1e6..064d8af3d 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -253,12 +253,17 @@ class ApplicationController < ActionController::Base
expires_in max_age.minutes, :private => false
end
- # Used to work out where to cache fragments
+ # Used to work out where to cache fragments. We add an extra path to the
+ # URL using the first three digits of the info request id, because we can't
+ # have more than 32,000 entries in one directory on an ext3 filesystem.
def foi_fragment_cache_path(param)
- return url_for(param)
+ path = url_for(param)
+ first_three_digits = param['id'].to_s()[0..2]
+ path = path.sub("/request/", "/request/" + first_three_digits + "/")
end
def foi_fragment_cache_all_for_request(info_request)
- return "views/request/#{info_request.id}"
+ first_three_digits = info_request.id.to_s()[0..2]
+ return "views/request/#{first_three_digits}/#{info_request.id}"
end
# URL generating functions are needed by all controllers (for redirects),