-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall.php
More file actions
40 lines (37 loc) · 1.21 KB
/
uninstall.php
File metadata and controls
40 lines (37 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
/**
* Uninstall script for WooSecureProxy.
*
* This file is executed when the plugin is deleted via the WordPress admin.
* It performs complete cleanup of all plugin data:
* - Deletes stored settings/options
* - Clears non-persistent cache groups used for nonce and rate-limit tracking
*
* @package WooSecureProxy
* @since 1.0.0
*/
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
// Prevent direct access – only run when WordPress is uninstalling the plugin.
exit;
}
/**
* Remove all plugin options from the database.
*/
delete_option( 'wsp_allowed_tokens_json' );
delete_option( 'wsp_rate_limits_json' );
/**
* Clear non-persistent cache groups used by the proxy.
*
* These groups ('wsp_nonces' and 'wsp_rl') are registered as non-persistent
* during plugin initialization, but some object cache backends may still retain
* data. We flush them here for complete cleanup.
*/
foreach ( array( 'wsp_nonces', 'wsp_rl' ) as $group ) {
if ( function_exists( 'wp_cache_flush_group' ) ) {
// Preferred method in WordPress 6.1+.
wp_cache_flush_group( $group );
} else {
// Fallback for older WordPress versions.
wp_cache_delete_multiple( array_keys( wp_cache_get_multiple( array(), $group ) ), $group );
}
}