Skip to content

feat: add configurable log retention policy (v3.14.0) - #102

Merged
kunalnagar merged 4 commits into
masterfrom
feat/log-retention
Apr 22, 2026
Merged

feat: add configurable log retention policy (v3.14.0)#102
kunalnagar merged 4 commits into
masterfrom
feat/log-retention

Conversation

@kunalnagar

Copy link
Copy Markdown
Owner

Summary

  • Adds two independent log retention axes: Max Log Count (cap by row count) and Max Log Age (cap by age in days). Both default to 0 (disabled) — zero behaviour change for existing users.
  • Daily WP-Cron event (custom_404_pro_prune_logs) runs both passes automatically. Scheduled on activation, unscheduled on deactivation and uninstall.
  • On-demand Prune Logs Now button on the Logs page for immediate cleanup.
  • Log count stat and a 90%-threshold warning notice displayed on the Logs page.
  • Two new settings fields in the General tab with absint(wp_unslash()) sanitization.

Test plan

  • Unit tests: composer test — 36/36 pass
  • Integration tests: composer test:integration — 29/29 pass (5 new prune tests)
  • Verify Max Log Count = 5 with 6+ rows → Prune Now deletes the oldest row
  • Verify Max Log Age = 1 with a row inserted yesterday → daily cron or Prune Now removes it
  • Verify warning notice appears on Logs page when count ≥ 90% of the cap
  • Verify deactivation unschedules the cron event (wp cron event list)
  • Verify uninstall removes the cron hook and all plugin data cleanly

Adds two independent retention axes — row count cap and age cap — with a
daily WP-Cron cleanup job, an on-demand Prune Logs Now button on the Logs
page, and a stats/warning notice when approaching the count limit.

Both limits default to 0 (disabled) so existing installs see no behaviour
change until retention is explicitly configured.
@kunalnagar
kunalnagar merged commit bd452dc into master Apr 22, 2026
10 checks passed
@kunalnagar
kunalnagar deleted the feat/log-retention branch April 22, 2026 05:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant