FEATURE: clean up unmatched email/ip entries after a year

This commit is contained in:
Régis Hanol 2014-11-25 17:12:49 +01:00
parent f355d82265
commit e23a25994d
4 changed files with 37 additions and 0 deletions

View 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

View 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

View file

@ -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." 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." 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_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" 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"

View file

@ -578,6 +578,8 @@ spam:
max: 3 max: 3
max_new_accounts_per_registration_ip: 3 max_new_accounts_per_registration_ip: 3
min_ban_entries_for_roll_up: 5 min_ban_entries_for_roll_up: 5
max_age_unmatched_emails: 365
max_age_unmatched_ips: 365
rate_limits: rate_limits:
unique_posts_mins: unique_posts_mins: