Conditions | 6 |
Paths | 3 |
Total Lines | 22 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 42 |
Changes | 0 |
1 | <?php |
||
34 | function email_log_delete_table() { |
||
35 | global $wpdb; |
||
36 | |||
37 | $retain_email_log = get_option( 'el_email_log_core' ); |
||
38 | |||
39 | // This is hardcoded on purpose, since the entire plugin is not loaded during uninstall. |
||
40 | $table_name = $wpdb->prefix . 'email_log'; |
||
41 | |||
42 | if ( $wpdb->get_var( "SHOW TABLES LIKE '{$table_name}'" ) == $table_name ) { |
||
43 | if ( ! empty( $retain_email_log ) && |
||
44 | is_array( $retain_email_log ) && |
||
45 | array_key_exists( 'remove_on_uninstall', $retain_email_log ) && |
||
46 | 'true' === strtolower( $retain_email_log['remove_on_uninstall'] ) ) { |
||
47 | // If table is present, drop it |
||
48 | $wpdb->query( "DROP TABLE $table_name" ); |
||
49 | } |
||
50 | } |
||
51 | |||
52 | // Delete the options. |
||
53 | delete_option( 'email-log-db' ); |
||
54 | delete_option( 'el_email_log_core' ); |
||
55 | } |
||
56 |