-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathuninstall.php
More file actions
58 lines (50 loc) · 1.18 KB
/
uninstall.php
File metadata and controls
58 lines (50 loc) · 1.18 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
<?php
/**
* Plugin Uninstall Handler.
*
* @since 1.0.0
* @package Perform
* @subpackage Uninstall
*/
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit;
}
/**
* Handle Perform plugin uninstall process.
*
* @since 1.0.0
*/
function perform_handle_plugin_uninstall() {
$setting_types = array(
'perform_common',
'perform_ssl',
'perform_cdn',
'perform_woocommerce',
'perform_advanced',
'perform_import_export',
'perform_support',
);
if ( function_exists( 'perform_get_option' ) ) {
$remove_data_on_uninstall = perform_get_option( 'remove_data_on_uninstall', 'perform_advanced' );
} else {
$remove_data_on_uninstall = true; // Default to true on uninstall if not accessible.
}
if ( $remove_data_on_uninstall ) {
if ( is_multisite() ) {
$sites = get_sites( array( 'deleted' => 0 ) );
if ( ! empty( $sites ) ) {
foreach ( $sites as $site ) {
foreach ( $setting_types as $option ) {
delete_blog_option( (int) $site->blog_id, $option );
}
}
}
} else {
foreach ( $setting_types as $option ) {
delete_option( $option );
}
}
}
}
// Directly run the uninstall handler without needing constants.
perform_handle_plugin_uninstall();