-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall.php
More file actions
71 lines (59 loc) · 1.8 KB
/
uninstall.php
File metadata and controls
71 lines (59 loc) · 1.8 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
<?php
declare(strict_types=1);
/**
* Runs when the plugin is deleted from wp-admin.
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit;
}
global $wpdb;
// All direct queries below are intentional: delete_option() and
// delete_post_meta() don't support wildcard patterns, and this is a one-time
// uninstall operation rather than a hot path.
// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
// Consolidated usage counter map (single option as of v1.17.0).
delete_option( 'aldus_usage' );
// Legacy per-personality usage counter rows (aldus_usage_dispatch etc.) created
// before v1.17.0 — remove any that remain on older installs.
$wpdb->query(
$wpdb->prepare(
"DELETE FROM {$wpdb->options} WHERE option_name LIKE %s",
'aldus_usage_%'
)
);
// Per-personality error counters written on assembly failure.
$wpdb->query(
$wpdb->prepare(
"DELETE FROM {$wpdb->options} WHERE option_name LIKE %s",
'aldus_errors_%'
)
);
// Assembled-layout transients and their timeout entries.
$wpdb->query(
$wpdb->prepare(
"DELETE FROM {$wpdb->options} WHERE option_name LIKE %s",
'_transient_aldus_%'
)
);
$wpdb->query(
$wpdb->prepare(
"DELETE FROM {$wpdb->options} WHERE option_name LIKE %s",
'_transient_timeout_aldus_%'
)
);
// Post meta stored by the block (content items, layout history, lock list).
$wpdb->query(
"DELETE FROM {$wpdb->postmeta} WHERE meta_key IN ('_aldus_items','_aldus_locked_blocks','_aldus_layout_history')"
);
// User meta (dismissed notice tracking).
$wpdb->query(
$wpdb->prepare(
"DELETE FROM {$wpdb->usermeta} WHERE meta_key = %s",
'aldus_dismissed_notice_version'
)
);
// phpcs:enable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
wp_cache_flush();