PluginProbe ʕ •ᴥ•ʔ
Rank Math SEO – AI SEO Tools to Dominate SEO Rankings / 1.0.267
Rank Math SEO – AI SEO Tools to Dominate SEO Rankings v1.0.267
1.0.271 1.0.271.1 1.0.270 1.0.269 trunk 1.0.216 1.0.217 1.0.218 1.0.219 1.0.220 1.0.221 1.0.222 1.0.223 1.0.224 1.0.225 1.0.226 1.0.227 1.0.227.1 1.0.228 1.0.229 1.0.230 1.0.231 1.0.232 1.0.233 1.0.234 1.0.234.1 1.0.235 1.0.236 1.0.237 1.0.238 1.0.239 1.0.240 1.0.241 1.0.242 1.0.243 1.0.244 1.0.245 1.0.246 1.0.247 1.0.248 1.0.249 1.0.250 1.0.251 1.0.251.1 1.0.252 1.0.252.1 1.0.253 1.0.254 1.0.255 1.0.256 1.0.257 1.0.258 1.0.259 1.0.259.1 1.0.260 1.0.261 1.0.262 1.0.263 1.0.264 1.0.264.1 1.0.265 1.0.266 1.0.266.1 1.0.267 1.0.268
seo-by-rank-math / uninstall.php
seo-by-rank-math Last commit date
assets 2 months ago includes 2 months ago languages 2 months ago vendor 2 months ago rank-math.php 2 months ago readme.txt 2 months ago uninstall.php 1 year ago wpml-config.xml 5 years ago
uninstall.php
128 lines
1 <?php
2 /**
3 * Fired when the plugin is uninstalled.
4 *
5 * When populating this file, consider the following flow
6 * of control:
7 *
8 * - This method should be static
9 * - Check if the $_REQUEST content actually is the plugin name
10 * - Run an admin referrer check to make sure it goes through authentication
11 * - Verify the output of $_GET makes sense
12 * - Repeat with other user roles. Best directly by using the links/query string parameters.
13 * - Repeat things for multisite. Once for a single site in the network, once sitewide.
14 *
15 * This file may be updated more in future version of the Boilerplate; however, this is the
16 * general skeleton and outline for how the file should work.
17 *
18 * @link https://rankmath.com
19 * @since 0.9.0
20 * @package RANK_MATH
21 */
22
23 // If uninstall not called from WordPress, then exit.
24 if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
25 exit;
26 }
27
28 // Clear scheduled tasks.
29 if ( class_exists( 'ActionScheduler_QueueRunner' ) ) {
30 ActionScheduler_QueueRunner::instance()->unhook_dispatch_async_request();
31 }
32 if ( class_exists( 'ActionScheduler_DBStore' ) ) {
33 ActionScheduler_DBStore::instance()->cancel_actions_by_group( 'rank-math' );
34 }
35
36 // Set rank_math_clear_data_on_uninstall to TRUE to delete all data on uninstall.
37 if ( true === apply_filters( 'rank_math_clear_data_on_uninstall', false ) ) {
38
39 if ( ! is_multisite() ) {
40 rank_math_remove_data();
41 return;
42 }
43
44 global $wpdb;
45
46 $blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs WHERE archived = '0' AND spam = '0' AND deleted = '0'" );
47 if ( ! empty( $blog_ids ) ) {
48 foreach ( $blog_ids as $site_id ) {
49 switch_to_blog( $site_id );
50 rank_math_remove_data();
51 restore_current_blog();
52 }
53 }
54 }
55
56 /**
57 * Removes ALL plugin data
58 *
59 * @since 1.0.35
60 */
61 function rank_math_remove_data() {
62 // Delete all options.
63 rank_math_delete_options();
64
65 // Delete meta for post, user and term.
66 rank_math_delete_meta( 'post' );
67 rank_math_delete_meta( 'user' );
68 rank_math_delete_meta( 'term' );
69
70 // Drop Tables.
71 rank_math_drop_table( '404_logs' );
72 rank_math_drop_table( 'redirections' );
73 rank_math_drop_table( 'redirections_cache' );
74 rank_math_drop_table( 'internal_links' );
75 rank_math_drop_table( 'internal_meta' );
76 rank_math_drop_table( 'analytics_gsc' );
77 rank_math_drop_table( 'analytics_objects' );
78 rank_math_drop_table( 'analytics_inspections' );
79
80 // Remove Capabilities.
81 /**
82 * PSR-4 Autoload.
83 */
84 include __DIR__ . '/vendor/autoload.php';
85
86 \RankMath\Role_Manager\Capability_Manager::get()->remove_capabilities();
87
88 // Clear any cached data that has been removed.
89 wp_cache_flush();
90 }
91
92 /**
93 * Delete options.
94 *
95 * @return void
96 */
97 function rank_math_delete_options() {
98 global $wpdb;
99
100 $where = $wpdb->prepare( 'WHERE option_name LIKE %s OR option_name LIKE %s', '%' . $wpdb->esc_like( 'rank-math' ) . '%', '%' . $wpdb->esc_like( 'rank_math' ) . '%' );
101 $wpdb->query( "DELETE FROM {$wpdb->prefix}options {$where}" ); // phpcs:ignore
102 }
103
104 /**
105 * Delete post meta.
106 *
107 * @param string $table Table name.
108 * @return void
109 */
110 function rank_math_delete_meta( $table = 'post' ) {
111 global $wpdb;
112
113 $where = $wpdb->prepare( 'WHERE meta_key LIKE %s OR meta_key LIKE %s', '%' . $wpdb->esc_like( 'rank-math' ) . '%', '%' . $wpdb->esc_like( 'rank_math' ) . '%' );
114 $wpdb->query( "DELETE FROM {$wpdb->prefix}{$table}meta {$where}" ); // phpcs:ignore
115 }
116
117 /**
118 * Drop table from database
119 *
120 * @param string $name Name of table.
121 * @return void
122 */
123 function rank_math_drop_table( $name ) {
124 global $wpdb;
125
126 $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}rank_math_{$name}" ); // phpcs:ignore
127 }
128