PluginProbe ʕ •ᴥ•ʔ
Smush – Image Optimization, Compression, Lazy Load, WebP & CDN / 3.2.4
Smush – Image Optimization, Compression, Lazy Load, WebP & CDN v3.2.4
4.1.0 4.0.3 4.0.2 2.8.1 2.9.1 3.0.0 3.0.1 3.0.2 3.1.1 3.10.1 3.10.2 3.10.3 3.11.1 3.12.3 3.12.4 3.12.5 3.12.6 3.13.0 3.13.1 3.13.2 3.14.0 3.14.1 3.14.2 3.15.0 3.15.1 3.15.2 3.15.3 3.15.4 3.15.5 3.16.2 3.16.4 3.16.5 3.16.6 3.17.0 3.17.1 3.18.0 3.18.1 3.2.0.1 3.2.1 3.2.2.1 3.2.4 3.20.0 3.21.1 3.22.1 3.22.3 3.23.0 3.23.1 3.23.2 3.23.3 3.23.4 3.24.0 3.24.0-beta.2 3.3.0 3.3.1 3.3.2 3.4.1 3.4.2 3.6.1 3.6.3 3.7.0 3.7.1 3.7.2 3.7.3 3.8.2 3.8.3 3.8.4 3.8.5 3.8.7 3.8.8 3.9.0 3.9.1 3.9.11 3.9.2 3.9.4 3.9.5 3.9.8 3.9.9 trunk 1.0.0 1.0.1 1.0.2 1.1 1.1.1 1.1.2 1.1.3 1.2 1.2.1 1.2.10 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.1 1.3.2 1.3.3 1.3.4 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.5.1 1.6.5.2 1.6.5.3 1.6.5.4 1.7 1.7.1 1.7.1.1 2.0 2.0.1 2.0.3 2.0.4 2.0.5 2.0.6 2.0.6.2 2.0.6.3 2.0.6.5 2.0.7 2.0.7.1 2.1 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.2 2.2.1 2.2.2 2.3 2.3.1 2.4 2.4.2 2.4.3 2.4.4 2.4.5 2.5.2 2.5.3 2.6.1 2.6.2 2.6.3 2.7 2.7.1 2.7.4 2.7.4.1 2.7.5 2.7.6 2.7.8 2.7.8.1 2.7.9.1 2.8.0 2.8.0.1
wp-smushit / uninstall.php
wp-smushit Last commit date
_src 6 years ago app 6 years ago core 6 years ago languages 6 years ago readme.txt 6 years ago uninstall.php 6 years ago wp-smush.php 6 years ago
uninstall.php
172 lines
1 <?php
2 /**
3 * Remove plugin settings data.
4 *
5 * @since 1.7
6 * @package WP_Smush
7 */
8
9 // If uninstall not called from WordPress exit.
10 if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
11 exit();
12 }
13
14 if ( ! class_exists( 'WP_Smush_Settings' ) ) {
15 if ( ! defined( 'WP_SMUSH_PREFIX' ) ) {
16 define( 'WP_SMUSH_PREFIX', 'wp-smush-' );
17 }
18 /* @noinspection PhpIncludeInspection */
19 include_once plugin_dir_path( __FILE__ ) . '/core/class-wp-smush-settings.php';
20 }
21 $keep_data = WP_Smush_Settings::get_instance()->get( 'keep_data' );
22
23 // Check if someone want to keep the stats and settings.
24 if ( ( defined( 'WP_SMUSH_PRESERVE_STATS' ) && WP_SMUSH_PRESERVE_STATS ) || true === $keep_data ) {
25 return;
26 }
27
28 global $wpdb;
29
30 $smushit_keys = array(
31 'resize-sizes',
32 'resmush-list',
33 'resize_sizes',
34 'transparent_png',
35 'image_sizes',
36 'nextgen-resmush-list',
37 'super_smushed',
38 'super_smushed_nextgen',
39 'settings_updated',
40 'hide_smush_welcome',
41 'hide_upgrade_notice',
42 'hide_update_info',
43 'install-type',
44 'version',
45 'scan',
46 'settings',
47 'cdn_status',
48 'lazy_load',
49 'last_run_sync',
50 'networkwide',
51 );
52
53 $db_keys = array(
54 'skip-smush-setup',
55 'smush_global_stats',
56 'smush-directory-path-hash-updated',
57 );
58
59 // Cache Keys.
60 $cache_keys = array(
61 'smush_global_stats',
62 );
63
64 $cache_smush_group = array(
65 'exceeding_items',
66 'wp-smush-resize_savings',
67 'pngjpg_savings',
68 );
69
70 $cache_nextgen_group = array(
71 'wp_smush_images',
72 'wp_smush_images_smushed',
73 'wp_smush_images_unsmushed',
74 'wp_smush_stats_nextgen',
75 );
76
77 if ( ! is_multisite() ) {
78 // Delete Options.
79 foreach ( $smushit_keys as $key ) {
80 $key = 'wp-smush-' . $key;
81 delete_option( $key );
82 delete_site_option( $key );
83 }
84
85 foreach ( $db_keys as $key ) {
86 delete_option( $key );
87 delete_site_option( $key );
88 }
89
90 // Delete Cache data.
91 foreach ( $cache_keys as $key ) {
92 wp_cache_delete( $key );
93 }
94
95 foreach ( $cache_smush_group as $s_key ) {
96 wp_cache_delete( $s_key, 'smush' );
97 }
98
99 foreach ( $cache_nextgen_group as $n_key ) {
100 wp_cache_delete( $n_key, 'nextgen' );
101 }
102 }
103
104 // Delete Directory Smush stats.
105 delete_option( 'dir_smush_stats' );
106 delete_option( 'wp_smush_scan' );
107 delete_option( 'wp_smush_api_auth' );
108 delete_site_option( 'wp_smush_api_auth' );
109
110 // Delete Post meta.
111 $meta_type = 'post';
112 $meta_key = 'wp-smpro-smush-data';
113 $meta_value = '';
114 $delete_all = true;
115
116 if ( is_multisite() ) {
117 $offset = 0;
118 $limit = 100;
119 while ( $blogs = $wpdb->get_results( "SELECT blog_id FROM {$wpdb->blogs} LIMIT $offset, $limit", ARRAY_A ) ) {
120 if ( $blogs ) {
121 foreach ( $blogs as $blog ) {
122 switch_to_blog( $blog['blog_id'] );
123 delete_metadata( $meta_type, null, $meta_key, $meta_value, $delete_all );
124 delete_metadata( $meta_type, null, 'wp-smush-lossy', '', $delete_all );
125 delete_metadata( $meta_type, null, 'wp-smush-resize_savings', '', $delete_all );
126 delete_metadata( $meta_type, null, 'wp-smush-original_file', '', $delete_all );
127 delete_metadata( $meta_type, null, 'wp-smush-pngjpg_savings', '', $delete_all );
128
129 foreach ( $smushit_keys as $key ) {
130 $key = 'wp-smush-' . $key;
131 delete_option( $key );
132 delete_site_option( $key );
133 }
134
135 foreach ( $db_keys as $key ) {
136 delete_option( $key );
137 delete_site_option( $key );
138 }
139
140 // Delete Cache data.
141 foreach ( $cache_keys as $key ) {
142 wp_cache_delete( $key );
143 }
144
145 foreach ( $cache_smush_group as $s_key ) {
146 wp_cache_delete( $s_key, 'smush' );
147 }
148
149 foreach ( $cache_nextgen_group as $n_key ) {
150 wp_cache_delete( $n_key, 'nextgen' );
151 }
152 }
153 restore_current_blog();
154 }
155 $offset += $limit;
156 }
157 } else {
158 delete_metadata( $meta_type, null, $meta_key, $meta_value, $delete_all );
159 delete_metadata( $meta_type, null, 'wp-smush-lossy', '', $delete_all );
160 delete_metadata( $meta_type, null, 'wp-smush-resize_savings', '', $delete_all );
161 delete_metadata( $meta_type, null, 'wp-smush-original_file', '', $delete_all );
162 delete_metadata( $meta_type, null, 'wp-smush-pngjpg_savings', '', $delete_all );
163 }
164 // Delete Directory smush table.
165 $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}smush_dir_images" );
166
167 // Delete directory scan data.
168 delete_option( 'wp-smush-scan-step' );
169
170 // TODO: Add procedure to delete backup files
171 // TODO: Update NextGen Metadata to remove Smush stats on plugin deletion.
172