Skip to content

fix: unschedule deprecated per-add-on license check cron on upgrade to 6.16.0 - #1686

Merged
jakejackson1 merged 2 commits into
hot-patch-6.16.0from
fix/remove-legacy-license-check-cron
Jul 24, 2026
Merged

fix: unschedule deprecated per-add-on license check cron on upgrade to 6.16.0#1686
jakejackson1 merged 2 commits into
hot-patch-6.16.0from
fix/remove-legacy-license-check-cron

Conversation

@jakejackson1

Copy link
Copy Markdown
Member

Summary

In 6.16.0 the individual gfpdf_<slug>_license_check cron events were superseded by a single gfpdf_bulk_license_check. New code no longer schedules the per-add-on events, but there was no upgrade routine to remove the ones already scheduled on existing sites — so upgraded installs carried orphaned cron entries that only expired on their own after firing once.

This adds a 6.16.0 upgrade routine that unschedules those deprecated events.

Changes

  • src/Controller/Controller_Upgrade_Routines.php — new remove_legacy_license_check_cron(), wired into the existing >= 6.16.0 upgrade branch alongside remove_legacy_update_cache(). It sweeps the cron array via _get_cron_array() and calls wp_unschedule_hook() on every hook matching ^gfpdf_.+_license_check$, explicitly excluding the live gfpdf_bulk_license_check.
  • tests/phpunit/unit-tests/Controller/Test_Controller_Upgrade_Routines.php — new test verifying the deprecated per-add-on events are removed while the bulk check and an unrelated gfpdf_* hook survive.
  • CHANGELOG.md — Housekeeping entry under 6.16.0.

Design notes

  • Sweep by pattern, not by registered add-on. Iterating $this->data->addon would only see currently-active add-ons; a pattern sweep also clears events left behind by add-ons that are no longer active — which is exactly the orphaned case this routine targets.
  • wp_unschedule_hook() over wp_clear_scheduled_hook(). The former clears all events for a hook regardless of args, which is the correct primitive for a catch-all sweep.
  • Bulk-hook exclusion. The regex ^gfpdf_.+_license_check$ also matches gfpdf_bulk_license_check, so the routine explicitly skips it to avoid unscheduling the replacement event.

Testing

  • php -l clean on the changed files.
  • --group upgrade suite passes on live wp-env (3 tests, 9 assertions).

Note on multisite

This runs per-site on version change (via gfpdf_version_changed), so each site clears its own cron when its stored version rolls over — the intended behaviour. A network-wide immediate sweep would require iterating sites explicitly; happy to add if wanted.

🤖 Generated with Claude Code

jakejackson1 and others added 2 commits July 24, 2026 16:37
…o 6.16.0

The individual gfpdf_<slug>_license_check events were replaced by a single
gfpdf_bulk_license_check in 6.16.0, but existing sites retained the old
per-add-on entries because no upgrade routine removed them.

Add a 6.16.0 upgrade routine that sweeps the cron array and unschedules any
gfpdf_*_license_check hook, excluding the bulk check that replaced them.
Sweeping by pattern (rather than iterating registered add-ons) also clears
events left behind by add-ons that are no longer active.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
No public API enumerates all scheduled hooks, so the sweep reads the cron
array via core's internal _get_cron_array(). Document that this is deliberate
and that the is_array() guard covers its historically-varied return type.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jakejackson1
jakejackson1 merged commit 1d5a13e into hot-patch-6.16.0 Jul 24, 2026
13 of 14 checks passed
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