Skip to content

Clean up stale license data on invalid_license error#10

Merged
shazzad merged 1 commit into
mainfrom
invalid-license-cleanup
Feb 25, 2026
Merged

Clean up stale license data on invalid_license error#10
shazzad merged 1 commit into
mainfrom
invalid-license-cleanup

Conversation

@shazzad
Copy link
Copy Markdown
Owner

@shazzad shazzad commented Feb 25, 2026

When a license is deleted upstream, the API returns an invalid_license WP_Error but locally stored license code and data remained in the database. This adds cleanup logic to Admin (save/sync) and Tracker (hourly cron) to delete stored license code and data on that error.

  • Add delete_license_code() and delete_license_data() helpers to Integration
  • Handle invalid_license error in Admin::handle_save() and handle_sync()
  • Handle invalid_license error in Tracker::sync_license_data()
  • Refactor bare delete_option() in handle_save() to use delete_license_code()
  • Add unit tests for the new delete helpers

When a license is deleted upstream, the API returns an invalid_license
WP_Error but locally stored license code and data remained in the
database. This adds cleanup logic to Admin (save/sync) and Tracker
(hourly cron) to delete stored license code and data on that error.

- Add delete_license_code() and delete_license_data() helpers to Integration
- Handle invalid_license error in Admin::handle_save() and handle_sync()
- Handle invalid_license error in Tracker::sync_license_data()
- Refactor bare delete_option() in handle_save() to use delete_license_code()
- Add unit tests for the new delete helpers

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@shazzad shazzad merged commit 572a052 into main Feb 25, 2026
1 check passed
@shazzad shazzad deleted the invalid-license-cleanup branch February 25, 2026 17:08
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