PluginProbe ʕ •ᴥ•ʔ
XML Sitemap & Google News / trunk
XML Sitemap & Google News vtrunk
5.7.7 5.7.5 5.7.6 5.7.4 trunk 1.0 2.0 2.1 3.0 3.2 3.3 3.4 3.5 3.6.1 3.7.4 3.8.8 3.9.3 4.0.1 4.1.4 4.2.3 4.3.2 4.4.1 4.5.1 4.6.3 4.7.5 4.8.3 4.9.4 5.0.7 5.1.2 5.2.7 5.3.6 5.4.6 5.4.9 5.5.1 5.5.2 5.5.3 5.5.4 5.5.5 5.5.6 5.5.7 5.5.8 5.5.9 5.6 5.6.1 5.6.2 5.6.3 5.7 5.7.1 5.7.2 5.7.3
xml-sitemap-feed / uninstall.php
xml-sitemap-feed Last commit date
assets 1 month ago inc 1 month ago views 1 month ago LICENSE 3 years ago readme.txt 1 month ago uninstall.php 1 month ago upgrade.php 1 month ago xml-sitemap.php 1 month ago
uninstall.php
108 lines
1 <?php
2 /**
3 * Plugin Uninstallation
4 *
5 * @package XML Sitemap & Google News
6 */
7
8 /**
9 * XMLSF_MULTISITE_UNINSTALL
10 *
11 * Set this constant in wp-config.php if you want to allow looping over each site
12 * in the network to run xmlsf_uninstall() defined in uninstall.php
13 *
14 * There is batch-processing on non-large networks.
15 * The constant XMLSF_MULTISITE_UNINSTALL needs to be set explicitly on networks over 10k sites.
16 *
17 * Example:
18 * define( 'XMLSF_MULTISITE_UNINSTALL', true);
19 */
20
21 // Exit if uninstall not called from WordPress.
22 defined( 'WP_UNINSTALL_PLUGIN' ) || exit();
23
24 global $wpdb;
25
26 // Check if it is a multisite and if XMLSF_MULTISITE_UNINSTALL constant is defined
27 // if so, run the uninstall function for each blog id.
28 if ( is_multisite() && ( ! wp_is_large_network() || ( defined( 'XMLSF_MULTISITE_UNINSTALL' ) && XMLSF_MULTISITE_UNINSTALL ) ) ) {
29 // Logging.
30 WP_DEBUG && WP_DEBUG_LOG && error_log( 'Clearing XML Sitemap Feeds settings from each site before uninstall:' );
31
32 $blogs = $wpdb->get_col( $wpdb->prepare( 'SELECT %s FROM %s', array( 'blog_id', $wpdb->prefix . 'blogs' ) ) );
33
34 foreach ( $blogs as $_id ) {
35 switch_to_blog( $_id );
36 xmlsf_uninstall();
37 restore_current_blog();
38 // Logging.
39 WP_DEBUG && WP_DEBUG_LOG && error_log( $_id );
40 }
41 } else {
42 xmlsf_uninstall();
43
44 // Logging.
45 WP_DEBUG && WP_DEBUG_LOG && error_log( 'XML Sitemap Feeds settings cleared on uninstall.' );
46 }
47
48
49 /**
50 * Remove plugin data.
51 *
52 * @since 4.4
53 */
54 function xmlsf_uninstall() {
55 // Remove cache metadata.
56 // Should already have been done on plugin deactivation unless we're unstalling on multisite...
57
58 // Clear all meta caches...
59 delete_metadata( 'post', 0, '_xmlsf_image_attached', '', true );
60 delete_metadata( 'post', 0, '_xmlsf_image_featured', '', true );
61 delete_metadata( 'post', 0, '_xmlsf_comment_date_gmt', '', true );
62 delete_metadata( 'term', 0, 'term_modified', '', true );
63 delete_metadata( 'user', 0, 'user_modified', '', true );
64
65 // Remove post meta data.
66 delete_metadata( 'post', 0, '_xmlsf_exclude', '', true );
67 delete_metadata( 'post', 0, '_xmlsf_news_exclude', '', true );
68
69 // Remove plugin settings.
70 delete_option( 'xmlsf_version' );
71 delete_option( 'xmlsf_sitemaps' );
72 delete_option( 'xmlsf_server' );
73 delete_option( 'xmlsf_disabled_providers' );
74 delete_option( 'xmlsf_post_types' );
75 delete_option( 'xmlsf_taxonomies' );
76 delete_option( 'xmlsf_taxonomy_settings' );
77 delete_option( 'xmlsf_author_settings' );
78 delete_option( 'xmlsf_ping' );
79 delete_option( 'xmlsf_robots' );
80 delete_option( 'xmlsf_urls' );
81 delete_option( 'xmlsf_custom_sitemaps' );
82 delete_option( 'xmlsf_domains' );
83 delete_option( 'xmlsf_news_tags' );
84 delete_option( 'xmlsf_authors' );
85 delete_option( 'xmlsf_post_type_settings' );
86 delete_option( 'xmlsf_gsc_connect' );
87
88 // Remove old transient.
89 delete_transient( 'xmlsf_images_meta_primed' );
90 delete_transient( 'xmlsf_comments_meta_primed' );
91 delete_transient( 'xmlsf_static_files' );
92 delete_transient( 'gsc_connect_origin' );
93 delete_transient( 'sitemap_notifier_access_token' );
94 delete_transient( 'sitemap_notifier_bing_access_token' );
95 delete_transient( 'sitemap_notifier_google_access_token' );
96 delete_transient( 'sitemap_notifier_submission' );
97 delete_transient( 'sitemap_notifier_bing_submission' );
98 delete_transient( 'sitemap_notifier_google_submission' );
99 delete_transient( 'sitemap_notifier_submission_news' );
100
101 // Remove scheduled events.
102 wp_clear_scheduled_hook( 'xmlsf_gsc_keep_alive' );
103 wp_clear_scheduled_hook( 'xmlsf_bwt_keep_alive' );
104
105 // Flush rules.
106 flush_rewrite_rules( false );
107 }
108