prefix . $tableName; $logger->info( 'Dropping table if exists', [ 'plugin' => 'double-opt-in', 'table_name' => $wpTableName, 'class' => __CLASS__ ?? null, 'method' => __FUNCTION__, ] ); $wpdb->query( "DROP TABLE IF EXISTS " . esc_sql( $wpTableName ) ); $logger->info( 'Table dropped', [ 'plugin' => 'double-opt-in', 'table_name' => $wpTableName, ] ); } function drop_table_categories() { global $wpdb; $logger = Logger::getInstance(); $tableName = 'f12_cf7_doubleoptin_categories'; $wpTableName = $wpdb->prefix . $tableName; $logger->info( 'Dropping table if exists', [ 'plugin' => 'double-opt-in', 'table_name' => $wpTableName, 'class' => __CLASS__ ?? null, 'method' => __FUNCTION__, ] ); $wpdb->query( "DROP TABLE IF EXISTS " . esc_sql( $wpTableName ) ); $logger->info( 'Table dropped', [ 'plugin' => 'double-opt-in', 'table_name' => $wpTableName, ] ); } function drop_table_followup() { global $wpdb; // Follow-up status only references opt-ins; it goes with them. $wpdb->query( "DROP TABLE IF EXISTS " . esc_sql( $wpdb->prefix . 'f12_cf7_doubleoptin_followup' ) ); } if ( should_keep_data_on_uninstall() ) { Logger::getInstance()->info( 'Uninstall: keeping opt-in data (keep_data_on_uninstall enabled).', [ 'plugin' => 'double-opt-in', ] ); } else { Logger::getInstance()->info( 'Uninstall: deleting opt-in data (keep_data_on_uninstall disabled by admin).', [ 'plugin' => 'double-opt-in', ] ); drop_table_categories(); drop_table_followup(); drop_table_optin(); } // Purely operational options with no value after removal. Admin-set config // (f12-doi-settings) is intentionally left in place, and cross-package options // (bundle-pro licence, addon settings) are owned by their own uninstallers. delete_option( 'f12_cf7_doubleoptin_installed_at' ); delete_option( 'f12_cf7_doubleoptin_installation_uuid' ); delete_option( 'f12_cf7_doubleoptin_telemetry_counters' ); // The daily telemetry job is no longer scheduled, but an installation that ran // an older version still carries the event. Uninstalling has to take it with // it, otherwise the entry outlives the plugin in the WP-Cron table. wp_clear_scheduled_hook( 'f12_cf7_doubleoptin_daily_telemetry' ); wp_clear_scheduled_hook( 'f12_doi_follow_up_sweep' ); // Retry events carry the opt-in id as argument; only unschedule_hook // removes them regardless of arguments. wp_unschedule_hook( 'f12_doi_follow_up_retry' );