diff --git a/config/site_settings.yml b/config/site_settings.yml index 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: true clean_up_uploads: true - clean_orphan_uploads_grace_period_hours: 48 + clean_orphan_uploads_grace_period_hours: + default: 48 + max: 168 purge_deleted_uploads_grace_period_days: default: 30 max: 36500 diff --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.rb new file mode 100644 index 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 +end diff --git a/script/import_scripts/base.rb b/script/import_scripts/base.rb index a3df09e2f90..8588d742d7f 100644 --- a/script/import_scripts/base.rb +++ b/script/import_scripts/base.rb @@ -84,7 +84,7 @@ class ImportScripts::Base clean_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