<?php

if (!defined('ABSPATH')) {
    exit;
}

class List2Play_Servers_Deactivator {
    
    /**
     * Plugin deactivation
     */
    public static function deactivate() {
        // Clear all transients/cache
        // Direct DB query is acceptable in deactivator for cleanup purposes
        global $wpdb;
        
        // Delete all transients with our prefix
        // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
        $wpdb->query(
            $wpdb->prepare(
                "DELETE FROM {$wpdb->options} WHERE option_name LIKE %s OR option_name LIKE %s",
                $wpdb->esc_like('_transient_list2play_') . '%',
                $wpdb->esc_like('_transient_timeout_list2play_') . '%'
            )
        );
        
        // Flush rewrite rules
        flush_rewrite_rules();
    }
}

