FEATURE: Delete backups based on time window (#24296)

* FEATURE: core code, tests for feature to allow backups to removed based on a time window

* FEATURE: getting tests working for time-based backup

* FEATURE: getting tests running

* FEATURE: linting
This commit is contained in:
marstall
2023-12-13 13:00:27 -05:00
committed by GitHub
parent 6731eec42a
commit 0513865c3c
7 changed files with 52 additions and 12 deletions

View File

@ -42,6 +42,16 @@ module BackupRestore
reset_cache
end
def delete_prior_to_n_days
window = SiteSetting.remove_older_backups.to_i
return unless window && window.is_a?(Numeric) && window > 0
return unless cleanup_allowed?
files.each do |file|
delete_file(file.filename) if file.last_modified < Time.now.ago(window.days)
end
reset_cache
end
def remote?
fail NotImplementedError
end