fix(cleanup): delete Imagify transients on deactivation and uninstall#1027
Open
faisalahammad wants to merge 1 commit intowp-media:developfrom
Open
fix(cleanup): delete Imagify transients on deactivation and uninstall#1027faisalahammad wants to merge 1 commit intowp-media:developfrom
faisalahammad wants to merge 1 commit intowp-media:developfrom
Conversation
- Add delete_site_transient() for imagify_check_api_version and imagify_check_licence_1 in imagify_deactivation() - Add delete_site_transient( 'imagify_check_api_version' ) to uninstall.php - Add delete_transient( 'imagify_bulk_optimization_result' ) to uninstall.php Fixes wp-media#942
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
Deletes
imagify_check_api_versionand other missing transients on plugin deactivation and uninstall, so no Imagify data is left behind in the database.Fixes #942
Problem
The
imagify_check_api_versionsite transient (set byImagify_Requirements::is_api_up()) persists in the database after deactivating or deleting Imagify. A few other transients (imagify_check_licence_1,imagify_bulk_optimization_result) were also missing from cleanup hooks.Solution
Added the missing
delete_site_transient()/delete_transient()calls to both the deactivation hook anduninstall.php. This follows the existing pattern used byBulk::delete_transients_data().Changes
imagify.php
Before:
After:
Why: These site transients are set by
Imagify_Requirements::is_api_up()andis_api_key_valid()but were never cleared on deactivation. Placing the cleanup beforedo_action( 'imagify_deactivation' )ensures they're removed regardless of what other hooks do.uninstall.php
Added two missing lines to the existing transient cleanup block:
delete_site_transient( 'imagify_check_licence_1' ); +delete_site_transient( 'imagify_check_api_version' ); delete_site_transient( 'imagify_user' );delete_transient( 'imagify_stat_without_next_gen' ); +delete_transient( 'imagify_bulk_optimization_result' ); delete_transient( 'imagify_attachments_number_modal' );Testing
Manual Testing
Test 1: Deactivation cleanup
imagify_check_api_versiontransientimagify_check_api_versionandimagify_check_licence_1are deleted ✅Test 2: Uninstall cleanup
Screen recording
Screen recording: https://videos.faisalahammad.com/recordings/J88o1IstjuKlmsUkRyld
Plugin build
imagify-fix-issue-942.zip