fix: unschedule deprecated per-add-on license check cron on upgrade to 6.16.0 - #1686
Merged
jakejackson1 merged 2 commits intoJul 24, 2026
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
In 6.16.0 the individual
gfpdf_<slug>_license_checkcron events were superseded by a singlegfpdf_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— newremove_legacy_license_check_cron(), wired into the existing>= 6.16.0upgrade branch alongsideremove_legacy_update_cache(). It sweeps the cron array via_get_cron_array()and callswp_unschedule_hook()on every hook matching^gfpdf_.+_license_check$, explicitly excluding the livegfpdf_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 unrelatedgfpdf_*hook survive.CHANGELOG.md— Housekeeping entry under 6.16.0.Design notes
$this->data->addonwould 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()overwp_clear_scheduled_hook(). The former clears all events for a hook regardless of args, which is the correct primitive for a catch-all sweep.^gfpdf_.+_license_check$also matchesgfpdf_bulk_license_check, so the routine explicitly skips it to avoid unscheduling the replacement event.Testing
php -lclean on the changed files.--group upgradesuite 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