PluginProbe
Accessibility by AllAccessible / 2.1.6
Accessibility by AllAccessible v2.1.6
2.1.6 2.1.5 2.1.4 2.1.3 2.1.2 2.1.1 2.1.0 2.0.6 trunk 1.0 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.2 1.2.1 1.2.10 1.2.2 1.2.3 1.2.4 1.2.5 All 43 releases
allaccessible / uninstall.php

uninstall.php in Accessibility by AllAccessible 2.1.6, at uninstall.php

66 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * AllAccessible Uninstaller
4 *
5 * @package AllAccessible
6 * @since 1.3.7
7 */
8
9 // If uninstall not called from WordPress, exit
10 if (!defined('WP_UNINSTALL_PLUGIN')) {
11 exit;
12 }
13
14 /**
15 * Remove every trace of the plugin from the current site: all aacb_*
16 * options (including the HMAC plugin secret — it must not survive in DB
17 * backups or across reinstalls), all aacb_* transients, and scheduled
18 * events. The wildcard sweep is the source of truth; it covers keys
19 * added in any version without this file needing to track them.
20 */
21 function aacb_uninstall_site() {
22 global $wpdb;
23
24 // Options + transients in one sweep. Transients live in wp_options as
25 // _transient_aacb_* / _transient_timeout_aacb_*; site transients as
26 // _site_transient_aacb_*.
27 $wpdb->query(
28 "DELETE FROM {$wpdb->options}
29 WHERE option_name LIKE 'aacb\\_%'
30 OR option_name LIKE '\\_transient\\_aacb\\_%'
31 OR option_name LIKE '\\_transient\\_timeout\\_aacb\\_%'
32 OR option_name LIKE '\\_site\\_transient\\_aacb\\_%'
33 OR option_name LIKE '\\_site\\_transient\\_timeout\\_aacb\\_%'"
34 );
35
36 // Post meta (e.g. _aacb_context_map attachment-map cache).
37 $wpdb->query(
38 "DELETE FROM {$wpdb->postmeta}
39 WHERE meta_key LIKE 'aacb\\_%'
40 OR meta_key LIKE '\\_aacb\\_%'"
41 );
42
43 // Scheduled events (wp_unschedule_hook clears all occurrences,
44 // including single events scheduled with args).
45 wp_unschedule_hook('aacb_post_link_backfill_run');
46 wp_unschedule_hook('aacb_post_link_single');
47 wp_unschedule_hook('aacb_fetch_plugin_secret_event');
48 wp_unschedule_hook('aacb_daily_analytics_calculation'); // pre-2.1 legacy
49
50 wp_cache_flush();
51 }
52
53 aacb_uninstall_site();
54
55 // For multisite installations
56 if (is_multisite()) {
57 global $wpdb;
58 $blog_ids = $wpdb->get_col("SELECT blog_id FROM {$wpdb->blogs}");
59
60 foreach ($blog_ids as $blog_id) {
61 switch_to_blog($blog_id);
62 aacb_uninstall_site();
63 restore_current_blog();
64 }
65 }
66