From fa963e8f38909e0c233a288bda12d6b611a1a930 Mon Sep 17 00:00:00 2001 From: Jeff Atwood Date: Tue, 2 Jun 2015 04:26:01 -0700 Subject: [PATCH] Revert "Revert "FIX: new task to delete old drafts weekly"" This reverts commit c987a1d57103e50d787bb465848ccd696bded3a0. --- app/jobs/scheduled/clean_up_drafts.rb | 12 ++++++++++++ config/locales/server.en.yml | 2 ++ config/site_settings.yml | 2 ++ 3 files changed, 16 insertions(+) create mode 100644 app/jobs/scheduled/clean_up_drafts.rb diff --git a/app/jobs/scheduled/clean_up_drafts.rb b/app/jobs/scheduled/clean_up_drafts.rb new file mode 100644 index 00000000000..b3ace672b50 --- /dev/null +++ b/app/jobs/scheduled/clean_up_drafts.rb @@ -0,0 +1,12 @@ +module Jobs + class CleanUpDrafts < Jobs::Scheduled + every 1.week + + def execute(args) + delete_drafts_older_than_n_days = SiteSetting.delete_drafts_older_than_n_days.days.ago + + # remove old drafts + Draft.where("updated_at < ?", delete_drafts_older_than_n_days).destroy_all + end + end +end diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index d760b4b5f8d..9ca22fef336 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -1139,6 +1139,8 @@ en: enable_cdn_js_debugging: "Allow /logs to display proper errors by adding crossorigin permissions on all js includes." show_create_topics_notice: "If the site has fewer than 5 public topics, show a notice asking admins to create some topics." + delete_drafts_older_than_n_days: Delete drafts older than (n) days. + vacuum_db_days: "Run VACUUM FULL ANALYZE to reclaim DB space after migrations (set to 0 to disable)" prevent_anons_from_downloading_files: "Prevent anonymous users from downloading attachments. WARNING: this will prevent any non-image site assets posted as attachments from working." diff --git a/config/site_settings.yml b/config/site_settings.yml index 11c0641b85e..33764aff1ed 100644 --- a/config/site_settings.yml +++ b/config/site_settings.yml @@ -893,6 +893,8 @@ uncategorized: default: 0 hidden: true + delete_drafts_older_than_n_days: 90 + tos_topic_id: default: -1 hidden: true