| @@ -1,7 +1,9 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | defined( 'WP_UNINSTALL_PLUGIN' ) || exit; |
| 3 | 3 | |
| 4 | +require_once __DIR__ . '/classes/Tools/InternalStateList.php'; | |
| 5 | + | |
| 4 | 6 | global $wpdb; |
| 5 | 7 | |
| 6 | 8 | // Delete Imagify options. |
| 7 | 9 | delete_site_option( 'imagify_settings' ); |
| @@ -21,29 +23,22 @@ | ||
| 21 | 23 | delete_site_transient( 'do_imagify_rating_cron' ); |
| 22 | 24 | delete_site_transient( 'imagify_seen_rating_notice' ); |
| 23 | 25 | delete_site_transient( 'imagify_user_images_count' ); |
| 24 | 26 | delete_transient( 'imagify_activation' ); |
| 25 | -delete_transient( 'imagify_bulk_optimization_level' ); | |
| 26 | -delete_transient( 'imagify_bulk_optimization_infos' ); | |
| 27 | 27 | delete_transient( 'imagify_large_library' ); |
| 28 | 28 | delete_transient( 'imagify_max_image_size' ); |
| 29 | 29 | delete_transient( 'imagify_user' ); |
| 30 | 30 | delete_transient( 'imagify_stat_without_next_gen' ); |
| 31 | -delete_transient( 'imagify_bulk_optimization_result' ); | |
| 32 | 31 | delete_transient( 'imagify_attachments_number_modal' ); |
| 33 | 32 | delete_transient( 'imagify_user_cache' ); |
| 33 | +foreach ( \Imagify\Tools\InternalStateList::get_bulk_transients() as $transient ) { | |
| 34 | + delete_transient( $transient ); | |
| 35 | +} | |
| 34 | 36 | |
| 35 | 37 | // Delete transients. |
| 36 | -$transients = implode( | |
| 37 | - '" OR option_name LIKE "', | |
| 38 | - [ | |
| 39 | - '\_transient\_%imagify-auto-optimize-%', | |
| 40 | - '\_transient\_%imagify\_rpc\_%', | |
| 41 | - '\_transient\_imagify\_%\_process\_locked', | |
| 42 | - '\_site\_transient\_imagify\_%\_process\_lock%', | |
| 43 | - ] | |
| 44 | -); | |
| 45 | -$wpdb->query( "DELETE from $wpdb->options WHERE option_name LIKE \"$transients\"" ); // WPCS: unprepared SQL ok. | |
| 38 | +foreach ( \Imagify\Tools\InternalStateList::get_locked_transient_patterns() as $pattern ) { | |
| 39 | + $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->options} WHERE option_name LIKE %s", $pattern ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQLPlaceholders.LikeWildcardsInQuery | |
| 40 | +} | |
| 46 | 41 | |
| 47 | 42 | // Clear scheduled hooks. |
| 48 | 43 | wp_clear_scheduled_hook( 'imagify_rating_event' ); |
| 49 | 44 | wp_clear_scheduled_hook( 'imagify_update_library_size_calculations_event' ); |