prefix + plugin-literal names; no user input is involved. */ // phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery // phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching // phpcs:disable WordPress.DB.DirectDatabaseQuery.SchemaChange // Table identifiers below are interpolated from $wpdb->prefix / $wpdb->options // (WordPress-owned, never user input) and cannot be passed as prepared // placeholders, so the InterpolatedNotPrepared sniff does not apply here. // phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared // phpcs:disable WordPress.DB.PreparedSQL.NotPrepared if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) exit; /** * Remove all plugin data. Wrapped in a prefixed function so its working * variables stay out of the global scope (uninstall.php runs in global scope). */ function aegra_run_uninstall_cleanup() { global $wpdb; // ── Tables ────────────────────────────────────────────────────────────── $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}aegra_traffic" ); $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}aegra_login_attempts" ); $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}aegra_activity_sessions" ); $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}aegra_broken_links" ); // ── Options ───────────────────────────────────────────────────────────── $wpdb->query( "DELETE FROM {$wpdb->options} WHERE option_name LIKE 'aegra\_%'" ); // ── Transients ────────────────────────────────────────────────────────── $wpdb->query( "DELETE FROM {$wpdb->options} WHERE option_name LIKE '_transient_aegra\_%'" ); $wpdb->query( "DELETE FROM {$wpdb->options} WHERE option_name LIKE '_transient_timeout_aegra\_%'" ); // ── Cron ──────────────────────────────────────────────────────────────── $aegra_cron_hooks = [ 'aegra_perf_snapshot', 'aegra_db_scheduled_scan', 'aegra_send_scheduled_report', 'aegra_licence_recheck', 'aegra_activity_cleanup', 'aegra_link_scan', ]; foreach ( $aegra_cron_hooks as $aegra_hook ) { wp_clear_scheduled_hook( $aegra_hook ); } // Dynamic autoscan hooks. $aegra_crons = _get_cron_array(); if ( is_array( $aegra_crons ) ) { foreach ( $aegra_crons as $aegra_cron ) { foreach ( $aegra_cron as $aegra_cron_hook => $aegra_cron_events ) { if ( strpos( $aegra_cron_hook, 'aegra_autoscan_' ) === 0 ) { wp_clear_scheduled_hook( $aegra_cron_hook ); } } } } } aegra_run_uninstall_cleanup();