-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathuninstall.php
More file actions
78 lines (67 loc) · 1.54 KB
/
uninstall.php
File metadata and controls
78 lines (67 loc) · 1.54 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
/**
* WP Sitemaps Manager uninstallation.
*
* @package WP Sitemaps Manager
*
* @since 0.1
*/
namespace XMLSitemapsManager;
// Exit if uninstall not called from WordPress.
defined( 'WP_UNINSTALL_PLUGIN' ) || exit();
// Check if it is a multisite and not a large one.
if ( \is_multisite() ) {
if ( WP_DEBUG && WP_DEBUG_LOG ) {
\error_log( 'Clearing XML Sitemaps Manager settings from each site before uninstall:' );
}
if ( \wp_is_large_network() ) {
if ( WP_DEBUG && WP_DEBUG_LOG ) {
\error_log( 'Aborting multisite uninstall. Too many sites in your network.' );
}
uninstall();
return;
}
$_ids = get_sites(
array(
'fields' => 'ids',
'number' => -1,
)
); // TEST number = -1..1000.
foreach ( $_ids as $_id ) {
\switch_to_blog( $_id );
uninstall( $_id );
\restore_current_blog();
}
} else {
uninstall();
}
/**
* Remove plugin data.
*
* @since 0.1
*
* @param int $_id Blog ID.
*/
function uninstall( $_id = false ) {
/**
* Remove metadata.
*/
// Already done on plugin deactivation.
/**
* Remove plugin settings.
*/
\delete_option( 'xmlsm_version' );
\delete_option( 'xmlsm_sitemaps_fixes' );
\delete_option( 'xmlsm_max_urls' );
\delete_option( 'xmlsm_lastmod' );
\delete_option( 'xmlsm_sitemap_providers' );
\delete_option( 'xmlsm_disabled_subtypes' );
// Kilroy was here.
if ( WP_DEBUG && WP_DEBUG_LOG ) {
if ( $_id ) {
\error_log( 'XML Sitemaps Manager settings cleared for blog ID:' . $_id );
} else {
\error_log( 'XML Sitemaps Manager settings cleared on uninstall.' );
}
}
}