PluginProbe
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster / 2.7.0
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster v2.7.0
2.7.0 2.6.0 trunk 1.1.0 1.1.4 1.2.1 1.2.2 1.2.3 1.2.5 1.2.9 1.3.1 1.3.2 1.5.0 1.5.1 1.5.4 1.5.7 1.5.8 1.5.9 1.6.2 1.6.5 1.6.8 1.7.2 1.7.4 1.7.5 1.7.9 All 43 releases
← All changes | uninstall.php +61 -3 1.2.52.7.0 View file →
@@ -12,11 +12,12 @@
12 12
13 13 // Include file of Database Class.
14 14 require_once dirname( __FILE__ ) . '/includes/db.php';
15 15
16 -$options = get_option( 'sellkit', [] );
16 +$sellkit_options = get_option( 'sellkit', [] );
17 +$sellkit_multisite_delete_switch = is_multisite() ? get_site_option( 'delete_data' ) : false;
17 18
18 -if ( '1' === $options['delete_data'] ) {
19 +if ( '1' === $sellkit_options['delete_data'] || '1' === $sellkit_multisite_delete_switch ) {
19 20 // Drop Sellkit admin tables.
20 21 Sellkit\Database::drop_all_tables();
21 22
22 23 // Delete sellkit option from wp_options.
@@ -21,9 +22,23 @@
21 22
22 23 // Delete sellkit option from wp_options.
23 24 delete_option( 'sellkit' );
24 25
25 - // Delete alls sellkit posts with their related meta fields.
26 + if ( is_multisite() ) {
27 + sellkit_multisite_remove_tables();
28 + sellkit_multisite_remove_data();
29 + }
30 +
31 + sellkit_delete_posts();
32 +}
33 +
34 +/**
35 + * Deletes posts.
36 + *
37 + * @since 1.3.2
38 + * @return void
39 + */
40 +function sellkit_delete_posts() {
26 41 global $wpdb;
27 42
28 43 $posts_id = $wpdb->prefix . 'posts.id';
29 44 $meta_id = $wpdb->prefix . 'postmeta.post_id';
@@ -47,5 +62,48 @@
47 62 wp_cache_flush();
48 63
49 64 // Temporary option.
50 65 update_option( 'sellkit_pro_delete_data', '1' );
66 +}
67 +
68 +/**
69 + * Removes tables.
70 + *
71 + * @since 1.3.2
72 + * @return void
73 + */
74 +function sellkit_multisite_remove_tables() {
75 + global $wpdb;
76 +
77 + $database_name = DB_NAME;
78 +
79 + // phpcs:disable
80 + $query = $wpdb->get_results( "
81 + SELECT CONCAT( 'DROP TABLE ', GROUP_CONCAT(table_name) , ';' )
82 + AS statement FROM information_schema.tables
83 + WHERE table_schema = '$database_name' AND ( table_name LIKE '%_sellkit_contact_segmentation' OR table_name LIKE '%_sellkit_applied_funnel' );
84 + " );
85 +
86 + if ( ! empty( $query[0]->statement ) ) {
87 + $wpdb->query( $query[0]->statement );
88 + }
89 + // phpcs:enable
90 +}
91 +
92 +/**
93 + * Removes multisite data.
94 + *
95 + * @since 1.3.2
96 + * @return void
97 + */
98 +function sellkit_multisite_remove_data() {
99 + $sites = get_sites();
100 +
101 + foreach ( $sites as $site ) {
102 + switch_to_blog( $site->blog_id );
103 + sellkit_delete_posts();
104 + delete_option( 'sellkit' );
105 + restore_current_blog();
106 + }
107 +
108 + delete_site_option( 'delete_data' );
51 109 }