PluginProbe ʕ •ᴥ•ʔ
Check & Log Email – Easy Email Testing & Mail logging / 2.0.15
Check & Log Email – Easy Email Testing & Mail logging v2.0.15
2.0.15 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 2.0 2.0.1 2.0.10 2.0.11 2.0.12 2.0.13 2.0.13.1 2.0.13.2 2.0.14 2.0.2 2.0.3 2.0.4 2.0.5 2.0.5.1 2.0.6 2.0.7 2.0.8 2.0.9 trunk 0.5.7 0.6.0 0.6.1 0.6.2 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.12.1 1.0.13 1.0.13.1 1.0.2 1.0.3
check-email / uninstall.php
check-email Last commit date
assets 3 days ago include 3 days ago languages 3 days ago vendor 3 days ago changelog.txt 3 days ago check-email.php 3 days ago readme.txt 3 days ago uninstall.php 3 days ago
uninstall.php
68 lines
1 <?php
2
3 // exit if WordPress is not uninstalling the plugin.
4 if ( ! defined( 'ABSPATH' ) && ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
5 exit();
6 }
7
8 if ( is_multisite() ) {
9 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
10 $check_email_sites = get_sites();
11 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
12 foreach ( $check_email_sites as $check_email_site ) {
13 switch_to_blog( $check_email_site->blog_id );
14 check_email_delete_db_data();
15 restore_current_blog();
16 }
17 } else {
18 check_email_delete_db_data();
19 }
20 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound
21 function check_email_delete_db_data() {
22 global $wpdb;
23
24 $remove_data_on_uninstall = false;
25
26 $option = get_option( 'check-email-log-core' );
27 if ( is_array( $option ) && array_key_exists( 'remove_on_uninstall', $option ) &&
28 'true' === strtolower( $option['remove_on_uninstall'] ) ) {
29
30 $remove_data_on_uninstall = true;
31 }
32
33 // phpcs:ignore PluginCheck.Security.DirectDB.UnescapedDBParameter
34 $table_name = $wpdb->prefix . 'check_email_log';
35
36 if ( $remove_data_on_uninstall ) {
37 //phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching -- just to check if table exists
38 if ( $wpdb->get_var( $wpdb->prepare( "SHOW TABLES LIKE %s",$wpdb->esc_like( $table_name )) ) == $table_name ) {
39 // phpcs:ignore PluginCheck.Security.DirectDB.UnescapedDBParameter
40 $wpdb->query(
41 //phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.PreparedSQL.InterpolatedNotPrepared, WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.SchemaChange,PluginCheck.Security.DirectDB.UnescapedDBParameter -- Reason Custom table drop on uninstall
42 "DROP TABLE $table_name" );
43 }
44 $table_name_email_tracker = $wpdb->prefix . 'check_email_error_logs';
45 //phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching -- just to check if table exists
46 if ( $wpdb->get_var( $wpdb->prepare( "SHOW TABLES LIKE %s",$wpdb->esc_like( $table_name_email_tracker )) ) == $table_name_email_tracker ) {
47 // phpcs:ignore PluginCheck.Security.DirectDB.UnescapedDBParameter
48 $wpdb->query(
49 //phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.PreparedSQL.InterpolatedNotPrepared, WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.SchemaChange -- Reason Custom table drop on uninstall
50 "DROP TABLE $table_name_email_tracker" );
51 }
52
53 delete_option( 'check-email-log-db' );
54 delete_option( 'check-email-log-core' );
55 delete_option( 'check-email-smtp-options' );
56 delete_option( 'check_email_smtp_status' );
57
58 $roles = get_editable_roles();
59 foreach ( $roles as $role_name => $role_obj ) {
60 $role = get_role( $role_name );
61
62 if ( ! is_null( $role ) ) {
63 $role->remove_cap( 'manage_check_email' );
64 }
65 }
66 }
67 }
68