mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
FEATURE: clean up unmatched email/ip entries after a year
This commit is contained in:
parent
f355d82265
commit
e23a25994d
4 changed files with 37 additions and 0 deletions
16
app/jobs/scheduled/clean_up_unmatched_emails.rb
Normal file
16
app/jobs/scheduled/clean_up_unmatched_emails.rb
Normal file
|
@ -0,0 +1,16 @@
|
|||
module Jobs
|
||||
|
||||
class CleanUpUnmatchedEmails < Jobs::Scheduled
|
||||
every 1.day
|
||||
|
||||
def execute
|
||||
last_match_threshold = SiteSetting.max_age_unmatched_emails.days.ago
|
||||
|
||||
ScreenedEmail.where(action_type: ScreenedEmail.actions[:block])
|
||||
.where("last_match_at < ?", last_match_threshold)
|
||||
.destroy_all
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
16
app/jobs/scheduled/clean_up_unmatched_ips.rb
Normal file
16
app/jobs/scheduled/clean_up_unmatched_ips.rb
Normal file
|
@ -0,0 +1,16 @@
|
|||
module Jobs
|
||||
|
||||
class CleanUpUnmatchedIPs < Jobs::Scheduled
|
||||
every 1.day
|
||||
|
||||
def execute
|
||||
last_match_threshold = SiteSetting.max_age_unmatched_ips.days.ago
|
||||
|
||||
ScreenedIpAddress.where(action_type: ScreenedIpAddress.actions[:block])
|
||||
.where("last_match_at < ?", last_match_threshold)
|
||||
.destroy_all
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
|
@ -944,6 +944,9 @@ en:
|
|||
max_new_accounts_per_registration_ip: "If there are already (n) trust level 0 accounts from this IP (and none is a staff member or at TL2 or higher), stop accepting new signups from that IP."
|
||||
min_ban_entries_for_roll_up: "When clicking the Roll up button, will create a new subnet ban entry if there are at least (N) entries."
|
||||
|
||||
max_age_unmatched_emails: "Delete unmatched screened email entries after (N) days."
|
||||
max_age_unmatched_ips: "Delete unmatched screened IP entries after (N) days."
|
||||
|
||||
reply_by_email_enabled: "Enable replying to topics via email."
|
||||
reply_by_email_address: "Template for reply by email incoming email address, for example: %{reply_key}@reply.example.com or replies+%{reply_key}@example.com"
|
||||
|
||||
|
|
|
@ -578,6 +578,8 @@ spam:
|
|||
max: 3
|
||||
max_new_accounts_per_registration_ip: 3
|
||||
min_ban_entries_for_roll_up: 5
|
||||
max_age_unmatched_emails: 365
|
||||
max_age_unmatched_ips: 365
|
||||
|
||||
rate_limits:
|
||||
unique_posts_mins:
|
||||
|
|
Loading…
Reference in a new issue