This commit is contained in:
Javier Casares 2026-06-09 12:48:19 +00:00
commit ed5c696fbe

View file

@ -18,13 +18,18 @@ if ( function_exists( 'is_multisite' ) && is_multisite() ) {
if ( is_array( $network_options ) && ! empty( $network_options['delete_data_on_uninstall'] ) ) {
$should_delete_data = true;
} else {
$sites = get_sites( array( 'number' => 1, 'fields' => 'ids' ) );
$first_site_id = ! empty( $sites ) ? $sites[0] : 1;
$site_options = get_blog_option( $first_site_id, 'robotstxt_smtp_options', array() );
$sites = get_sites(
array(
'number' => 1,
'fields' => 'ids',
)
);
$first_site_id = ! empty( $sites ) ? $sites[0] : 1;
$site_options = get_blog_option( $first_site_id, 'robotstxt_smtp_options', array() );
$should_delete_data = is_array( $site_options ) && ! empty( $site_options['delete_data_on_uninstall'] );
}
} else {
$options = get_option( 'robotstxt_smtp_options', array() );
$options = get_option( 'robotstxt_smtp_options', array() );
$should_delete_data = is_array( $options ) && ! empty( $options['delete_data_on_uninstall'] );
}
@ -54,6 +59,7 @@ if ( ! function_exists( 'robotstxt_smtp_uninstall_cleanup_site' ) ) {
// Delete core SMTP transients.
robotstxt_smtp_uninstall_delete_transient_prefix( 'robotstxt_smtp_tool_', false );
robotstxt_smtp_uninstall_delete_transient_prefix( 'robotstxt_smtp_test_result_', false );
robotstxt_smtp_uninstall_delete_transient_prefix( 'robotstxt_smtp_rate_limit_', false );
// Delete Amazon SES transients.
robotstxt_smtp_uninstall_delete_transient_prefix( 'robotstxt_smtp_amazonses_quota_', false );
@ -91,6 +97,7 @@ if ( ! function_exists( 'robotstxt_smtp_uninstall_cleanup_network' ) ) {
// Delete core SMTP site transients.
robotstxt_smtp_uninstall_delete_transient_prefix( 'robotstxt_smtp_tool_', true );
robotstxt_smtp_uninstall_delete_transient_prefix( 'robotstxt_smtp_test_result_', true );
robotstxt_smtp_uninstall_delete_transient_prefix( 'robotstxt_smtp_rate_limit_', true );
// Delete Amazon SES site transients.
robotstxt_smtp_uninstall_delete_transient_prefix( 'robotstxt_smtp_amazonses_quota_', true );
@ -218,7 +225,7 @@ if ( ! function_exists( 'robotstxt_smtp_uninstall_delete_statistics_table' ) ) {
global $wpdb;
$table_name = $wpdb->base_prefix . 'robotstxt_smtp_stats';
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.SchemaChange
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.SchemaChange, WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- DROP TABLE cannot use placeholders; table name is a hardcoded constant prefixed by $wpdb->base_prefix.
$wpdb->query( "DROP TABLE IF EXISTS {$table_name}" );
// Delete the database version option.