namespace VPN_Guard; defined( 'ABSPATH' ) || exit; class Activator { public static function activate() { // Set installed timestamp if missing if ( ! get_option( 'vpn_guard_installed_on' ) ) { update_option( 'vpn_guard_installed_on', current_time( 'timestamp' ) ); } // 🔧 Create or update the vpn_guard_logs table global $wpdb; $table_name = $wpdb->prefix . 'vpn_guard_logs'; $charset_collate = $wpdb->get_charset_collate(); $sql = "CREATE TABLE $table_name ( id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, ip_address VARCHAR(100) NOT NULL, blocked_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, reason VARCHAR(255), user_agent TEXT, referer TEXT, requested_url TEXT, PRIMARY KEY (id) ) $charset_collate;"; require_once ABSPATH . 'wp-admin/includes/upgrade.php'; dbDelta( $sql ); // ✅ Set redirect flag update_option( 'vpn_guard_do_activation_redirect', true ); // Fire post-activation hook do_action( 'vpn_guard_after_activation' ); } }