mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 02:19:27 +08:00
FEATURE: new 'backup_time_of_day' site setting
This commit is contained in:
parent
16f509afb9
commit
72a7bd38e1
|
@ -1,7 +1,7 @@
|
|||
|
||||
module Jobs
|
||||
class ScheduleBackup < Jobs::Scheduled
|
||||
daily at: 3.hours
|
||||
daily at: 0.hours
|
||||
sidekiq_options retry: false
|
||||
|
||||
def execute(args)
|
||||
|
@ -12,7 +12,12 @@ module Jobs
|
|||
return if (date + SiteSetting.backup_frequency.days) > Time.now.to_date
|
||||
end
|
||||
|
||||
Jobs.enqueue_in(rand(10.minutes), :create_backup)
|
||||
Jobs.cancel_scheduled_job(:create_backup)
|
||||
|
||||
time_of_day = Time.parse(SiteSetting.backup_time_of_day)
|
||||
seconds = time_of_day.hour.hours + time_of_day.min.minutes + rand(10.minutes)
|
||||
|
||||
Jobs.enqueue_in(seconds, :create_backup)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -965,6 +965,7 @@ en:
|
|||
backup_frequency: "How frequently we create a site backup, in days."
|
||||
enable_s3_backups: "Upload backups to S3 when complete. IMPORTANT: requires valid S3 credentials entered in Files settings."
|
||||
s3_backup_bucket: "The remote bucket to hold backups. WARNING: Make sure it is a private bucket."
|
||||
backup_time_of_day: "Time of day when the backup should occur."
|
||||
|
||||
active_user_rate_limit_secs: "How frequently we update the 'last_seen_at' field, in seconds"
|
||||
verbose_localization: "Show extended localization tips in the UI"
|
||||
|
|
|
@ -850,6 +850,9 @@ backups:
|
|||
default: ''
|
||||
regex: "^[^A-Z_.]+$" # can't use '.' when using HTTPS
|
||||
shadowed_by_global: true
|
||||
backup_time_of_day:
|
||||
default: '3:30'
|
||||
regex: "^((0?(0|1|2|3|4|5|6|7|8|9)|(10|11|12|13|14|15|16|17|18|19|20|21|22|23))):\\d\\d$"
|
||||
|
||||
uncategorized:
|
||||
version_checks:
|
||||
|
|
Loading…
Reference in New Issue
Block a user