| 1 |
<?php |
| 2 |
defined( 'WP_UNINSTALL_PLUGIN' ) || die( 'Cheatin’ uh?' ); |
| 3 |
|
| 4 |
global $wpdb; |
| 5 |
|
| 6 |
// Delete Imagify options. |
| 7 |
delete_site_option( 'imagify_settings' ); |
| 8 |
delete_site_option( 'imagify_old_version' ); |
| 9 |
delete_site_option( 'imagify_files_db_version' ); |
| 10 |
delete_site_option( 'imagify_folders_db_version' ); |
| 11 |
delete_option( 'imagify_data' ); |
| 12 |
delete_option( 'ngg_imagify_data_db_version' ); |
| 13 |
delete_option( $wpdb->prefix . 'ngg_imagify_data_db_version' ); |
| 14 |
|
| 15 |
// Delete all transients. |
| 16 |
delete_site_transient( 'imagify_activation' ); |
| 17 |
delete_site_transient( 'imagify_check_licence_1' ); |
| 18 |
delete_site_transient( 'imagify_user' ); |
| 19 |
delete_site_transient( 'imagify_themes_plugins_to_sync' ); |
| 20 |
delete_site_transient( 'do_imagify_rating_cron' ); |
| 21 |
delete_site_transient( 'imagify_seen_rating_notice' ); |
| 22 |
delete_site_transient( 'imagify_user_images_count' ); |
| 23 |
delete_transient( 'imagify_activation' ); |
| 24 |
delete_transient( 'imagify_bulk_optimization_level' ); |
| 25 |
delete_transient( 'imagify_bulk_optimization_infos' ); |
| 26 |
delete_transient( 'imagify_large_library' ); |
| 27 |
delete_transient( 'imagify_max_image_size' ); |
| 28 |
delete_transient( 'imagify_user' ); |
| 29 |
delete_transient( 'imagify_stat_without_next_gen' ); |
| 30 |
|
| 31 |
// Delete transients. |
| 32 |
$transients = implode( '" OR option_name LIKE "', array( |
| 33 |
'\_transient\_%imagify-auto-optimize-%', |
| 34 |
'\_transient\_%imagify\_rpc\_%', |
| 35 |
'\_transient\_imagify\_%\_process\_locked', |
| 36 |
'\_site\_transient\_imagify\_%\_process\_lock%', |
| 37 |
) ); |
| 38 |
$wpdb->query( "DELETE from $wpdb->options WHERE option_name LIKE \"$transients\"" ); // WPCS: unprepared SQL ok. |
| 39 |
|
| 40 |
// Clear scheduled hooks. |
| 41 |
wp_clear_scheduled_hook( 'imagify_rating_event' ); |
| 42 |
wp_clear_scheduled_hook( 'imagify_update_library_size_calculations_event' ); |
| 43 |
|
| 44 |
// Delete all user meta related to Imagify. |
| 45 |
delete_metadata( 'user', '', '_imagify_ignore_notices', '', true ); |
| 46 |
|
| 47 |
// Drop the tables. |
| 48 |
$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->base_prefix . 'imagify_files' ); |
| 49 |
$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->base_prefix . 'imagify_folders' ); |
| 50 |
$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'ngg_imagify_data' ); |
| 51 |
|