A platform for community discussion. Free, open, simple.
FIX: Enforce proper max for clean_orphan_uploads_grace_period_hours (#25235)
Natalie Tay9bc78625af1d
diff --git a/config/site_settings.yml b/config/site_settings.ymlindex 1117b65e037..756714078e7 100644--- a/config/site_settings.yml+++ b/config/site_settings.yml@@ -1488,7 +1488,9 @@ files:regex: '\A((https?:\/\/.+)(\|https?:\/\/.+[|$])*)?\z'create_thumbnails: trueclean_up_uploads: true- clean_orphan_uploads_grace_period_hours: 48+ clean_orphan_uploads_grace_period_hours:+ default: 48+ max: 168purge_deleted_uploads_grace_period_days:default: 30max: 36500diff --git a/db/migrate/20240112021335_set_max_clean_orphan_uploads_grace_period_hours.rb b/db/migrate/20240112021335_set_max_clean_orphan_uploads_grace_period_hours.rbnew file mode 100644index 00000000000..5bf8b3a5da2--- /dev/null+++ b/db/migrate/20240112021335_set_max_clean_orphan_uploads_grace_period_hours.rb@@ -0,0 +1,13 @@+# frozen_string_literal: true++class SetMaxCleanOrphanUploadsGracePeriodHours < ActiveRecord::Migration[7.0]+ def up+ DB.exec <<~SQL+ UPDATE site_settings SET value = '168' WHERE name ='clean_orphan_uploads_grace_period_hours' and value::int > 168;+ SQL+ end++ def down+ raise ActiveRecord::IrreversibleMigration.new+ end+enddiff --git a/script/import_scripts/base.rb b/script/import_scripts/base.rbindex a3df09e2f90..8588d742d7f 100644--- a/script/import_scripts/base.rb+++ b/script/import_scripts/base.rb@@ -84,7 +84,7 @@ class ImportScripts::Baseclean_up_inactive_users_after_days: 0,clean_up_unused_staged_users_after_days: 0,clean_up_uploads: false,- clean_orphan_uploads_grace_period_hours: 1800,+ clean_orphan_uploads_grace_period_hours: 168,}end