Skip to content
Browse files

Merge pull request #873 from concerto/871_purge_pa

Added Activity model, ConcertoConfig entry, and cron entry to achieve #871
  • Loading branch information...
2 parents c956341 + 13c55e9 commit 1e2905f7e3439a1ed8af4336b34bd3960f443df2 @augustf augustf committed Feb 2, 2014
Showing with 12 additions and 0 deletions.
  1. +1 −0 config/initializers/02-concerto_config.rb
  2. +11 −0 lib/cron.rb
View
1 config/initializers/02-concerto_config.rb
@@ -49,6 +49,7 @@
ConcertoConfig.make_concerto_config("system_time_zone", 'Eastern Time (US & Canada)', :value_type => "timezone", :category => 'System')
ConcertoConfig.make_concerto_config("config_last_updated", "0", :value_type => "integer", :hidden => "true", :category => 'System')
ConcertoConfig.make_concerto_config("http_proxy_settings", "", :value_type => "string", :category => 'System', :description => 'http://username:password@hostname:port')
+ ConcertoConfig.make_concerto_config("keep_activity_log", "90", :value_type => "integer", :value_default => "90", :category => 'System', :description => 'Days to keep activity log for (where 0 is forever)')
end
View
11 lib/cron.rb
@@ -20,4 +20,15 @@ module Clockwork
every(1.day, 'Deny Expired Content Submissions') do
Submission.delay.deny_old_expired
end
+
+ if RUBY_VERSION >= "1.9"
+ every(1.day, 'Remove old public activity entries') do
+ unless ConcertoConfig[:keep_activity_log].to_i == 0
+ activities = PublicActivity::Activity.where("created_at > :days", {:days => ConcertoConfig[:keep_activity_log].to_i.days.ago}).destroy_all
+ end
+ end
+ end
+
end
+
+

0 comments on commit 1e2905f

Please sign in to comment.
Something went wrong with that request. Please try again.