Skip to content

Add periodic health check email for abandoned plugins#94

Draft
apermo wants to merge 2 commits intoZodiac1978:developfrom
apermo:feature/health-check-email
Draft

Add periodic health check email for abandoned plugins#94
apermo wants to merge 2 commits intoZodiac1978:developfrom
apermo:feature/health-check-email

Conversation

@apermo
Copy link
Copy Markdown
Contributor

@apermo apermo commented Apr 14, 2026

Summary

  • Adds a daily WP-Cron health check that scans all plugins for issues
  • Sends a summary email when closed, stale (>2 years), or untested plugins are found
  • Deduplicates via hash comparison — no repeat emails for unchanged issue sets
  • Clears notification flag on plugin updates, activation/deactivation, and manual cache clear
  • Email filterable via plugin_report_health_check_email

Closes #42

Architecture

Health check logic extracted into RT_Plugin_Report_Health_Check in includes/class-health-check.php — single responsibility, small testable methods:

  • is_closed( $report ) — check if report indicates closed plugin
  • is_stale( $report ) — check if not updated in 2+ years
  • is_untested( $report, $wp_latest ) — check if not tested with current WP
  • collect_warnings() — iterate all plugins, return categorized warnings
  • build_email( $warnings ) — compose the email data array
  • already_notified( $warnings ) — hash-based deduplication
  • clear_notification_flag() — reset on plugin changes

Cron hook registered outside is_admin() so WP-Cron can fire it.

Test plan (local, no Playground — email requires real wp_mail)

  • Activate plugin, verify cron event is scheduled (wp cron event list)
  • Trigger manually: wp cron event run plugin_report_health_check
  • Install a closed/stale plugin and verify email is sent
  • Run again without changes — verify no duplicate email
  • Update/remove a flagged plugin, run again — verify new email with updated set
  • Deactivate plugin, verify cron event is cleared

Comment thread rt-plugin-report.php Outdated
@apermo apermo force-pushed the feature/health-check-email branch 8 times, most recently from af84c21 to bb7a1e9 Compare April 14, 2026 10:16
Comment thread rt-plugin-report.php Outdated
Comment thread rt-plugin-report.php Outdated
Comment thread rt-plugin-report.php Outdated
Comment thread rt-plugin-report.php Outdated
@apermo apermo force-pushed the feature/health-check-email branch 3 times, most recently from f548133 to 3489df1 Compare April 14, 2026 13:38
Schedule a daily WP-Cron event that checks all
installed plugins for problems (closed, stale >2y,
untested with current WP) and sends a summary email
to the site admin. Deduplicates via hash comparison
to avoid repeated emails for the same issue set.
Clears the notification flag on plugin updates,
activation/deactivation, and manual cache clear.
@apermo apermo force-pushed the feature/health-check-email branch from 3489df1 to 00b1ca0 Compare April 14, 2026 13:42
Extract health check into fully static
RT_Plugin_Report_Health_Check class in
includes/class-health-check.php. Small testable
methods: is_closed(), is_stale(), is_untested(),
collect_warnings(), build_email(), already_notified().

Schedule daily WP-Cron event. Deduplicates via hash
to avoid repeated emails. Clears notification flag
on plugin updates, activation/deactivation, and
manual cache clear.
@apermo apermo force-pushed the feature/health-check-email branch from 00b1ca0 to 51524ad Compare April 14, 2026 13:50
@apermo apermo marked this pull request as ready for review April 14, 2026 13:53
@apermo apermo marked this pull request as draft April 14, 2026 13:54
@apermo
Copy link
Copy Markdown
Contributor Author

apermo commented Apr 14, 2026

@Zodiac1978 I haven't tested this yet, but it looks good to me, will you take over from here if it fits your vision?

@Zodiac1978
Copy link
Copy Markdown
Owner

I'm not sure how fast I can review this more deeply, but the described workflow looks fine to me.

@apermo
Copy link
Copy Markdown
Contributor Author

apermo commented Apr 14, 2026

Just take your time :)

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.

Add periodic check for abandoned plugins

2 participants