mirror of
https://github.com/discourse/discourse.git
synced 2025-05-28 13:51:18 +08:00
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:
@ -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
|
||||
|
Reference in New Issue
Block a user