aboutsummaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
authorfrancis <francis>2008-02-12 11:42:09 +0000
committerfrancis <francis>2008-02-12 11:42:09 +0000
commit2c93b06b7676fb7339baf1fd0ed30f2ca466206d (patch)
tree656ef0006b6446a6e4ca00e41e9c2a65fb6f0061 /app/models
parent1ddb79d6f180581a75895db8d9cd8890cef7cf3d (diff)
Delete old sessions and post redirects.
Diffstat (limited to 'app/models')
-rw-r--r--app/models/post_redirect.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/app/models/post_redirect.rb b/app/models/post_redirect.rb
index f98591c44..5227c64d0 100644
--- a/app/models/post_redirect.rb
+++ b/app/models/post_redirect.rb
@@ -25,7 +25,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: post_redirect.rb,v 1.15 2008-02-06 09:41:44 francis Exp $
+# $Id: post_redirect.rb,v 1.16 2008-02-12 11:42:09 francis Exp $
require 'openssl' # for random bytes function
@@ -84,6 +84,11 @@ class PostRedirect < ActiveRecord::Base
return post_redirects[0]
end
+ # Called from cron job delete-old-sessions
+ def self.delete_old_post_redirects
+ PostRedirect.delete_all "now() - updated_at > '1 year'"
+ end
+
end