-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall.php
More file actions
61 lines (55 loc) · 1.47 KB
/
uninstall.php
File metadata and controls
61 lines (55 loc) · 1.47 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
/**
* WPBridge 卸载脚本
*
* 当用户从 WordPress 删除插件时执行
*
* @package WPBridge
*/
// 如果不是通过 WordPress 卸载,则退出
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit;
}
// 删除所有插件选项
delete_option( 'wpbridge_sources' );
delete_option( 'wpbridge_settings' );
delete_option( 'wpbridge_ai_settings' );
delete_option( 'wpbridge_logs' );
delete_option( 'wpbridge_activated' );
delete_option( 'wpbridge_admin_notices' );
delete_option( 'wpbridge_encryption_key' );
delete_option( 'wpbridge_source_groups' );
delete_option( 'wpbridge_version_locks' );
delete_option( 'wpbridge_notifications' );
delete_option( 'wpbridge_api' );
// 删除所有加密存储的数据
global $wpdb;
$wpdb->query(
$wpdb->prepare(
"DELETE FROM {$wpdb->options} WHERE option_name LIKE %s",
$wpdb->esc_like( 'wpbridge_secure_' ) . '%'
)
);
// 删除所有 transient 缓存
$wpdb->query(
$wpdb->prepare(
"DELETE FROM {$wpdb->options} WHERE option_name LIKE %s",
$wpdb->esc_like( '_transient_wpbridge_' ) . '%'
)
);
$wpdb->query(
$wpdb->prepare(
"DELETE FROM {$wpdb->options} WHERE option_name LIKE %s",
$wpdb->esc_like( '_transient_timeout_wpbridge_' ) . '%'
)
);
// 清除定时任务
wp_clear_scheduled_hook( 'wpbridge_update_sources' );
// 清除对象缓存
if ( wp_using_ext_object_cache() ) {
if ( function_exists( 'wp_cache_flush_group' ) ) {
wp_cache_flush_group( 'wpbridge' );
} else {
wp_cache_delete( 'wpbridge', 'wpbridge' );
}
}