| Server IP : 45.162.171.154 / Your IP : 216.73.216.5 Web Server : Apache System : Linux vxct2015.avnam.net 5.4.106-1-pve #1 SMP PVE 5.4.106-1 (Fri, 19 Mar 2021 11:08:47 +0100) x86_64 User : lpg.com.ar ( 1041) PHP Version : 8.3.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/lpg.com.ar/public_html/wp-content/plugins/check-email/ |
Upload File : |
<?php
// exit if WordPress is not uninstalling the plugin.
if ( ! defined( 'ABSPATH' ) && ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit();
}
if ( is_multisite() ) {
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
$check_email_sites = get_sites();
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
foreach ( $check_email_sites as $check_email_site ) {
switch_to_blog( $check_email_site->blog_id );
check_email_delete_db_data();
restore_current_blog();
}
} else {
check_email_delete_db_data();
}
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound
function check_email_delete_db_data() {
global $wpdb;
$remove_data_on_uninstall = false;
$option = get_option( 'check-email-log-core' );
if ( is_array( $option ) && array_key_exists( 'remove_on_uninstall', $option ) &&
'true' === strtolower( $option['remove_on_uninstall'] ) ) {
$remove_data_on_uninstall = true;
}
// phpcs:ignore PluginCheck.Security.DirectDB.UnescapedDBParameter
$table_name = $wpdb->prefix . 'check_email_log';
if ( $remove_data_on_uninstall ) {
//phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching -- just to check if table exists
if ( $wpdb->get_var( $wpdb->prepare( "SHOW TABLES LIKE %s",$wpdb->esc_like( $table_name )) ) == $table_name ) {
// phpcs:ignore PluginCheck.Security.DirectDB.UnescapedDBParameter
$wpdb->query(
//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
"DROP TABLE $table_name" );
}
$table_name_email_tracker = $wpdb->prefix . 'check_email_error_logs';
//phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching -- just to check if table exists
if ( $wpdb->get_var( $wpdb->prepare( "SHOW TABLES LIKE %s",$wpdb->esc_like( $table_name_email_tracker )) ) == $table_name_email_tracker ) {
// phpcs:ignore PluginCheck.Security.DirectDB.UnescapedDBParameter
$wpdb->query(
//phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.PreparedSQL.InterpolatedNotPrepared, WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.SchemaChange -- Reason Custom table drop on uninstall
"DROP TABLE $table_name_email_tracker" );
}
delete_option( 'check-email-log-db' );
delete_option( 'check-email-log-core' );
delete_option( 'check-email-smtp-options' );
delete_option( 'check_email_smtp_status' );
$roles = get_editable_roles();
foreach ( $roles as $role_name => $role_obj ) {
$role = get_role( $role_name );
if ( ! is_null( $role ) ) {
$role->remove_cap( 'manage_check_email' );
}
}
}
}