-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathuninstall.php
More file actions
64 lines (60 loc) · 2.05 KB
/
Copy pathuninstall.php
File metadata and controls
64 lines (60 loc) · 2.05 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
<?php
/**
* CloudScale Cleanup, Uninstall
*
* Removes all plugin options and clears scheduled cron events when the plugin
* is deleted via Plugins > Delete.
*/
defined( 'ABSPATH' ) || exit;
defined( 'WP_UNINSTALL_PLUGIN' ) || exit;
// Settings.
$options = [ // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- file-scope variables in uninstall.php only; no namespace conflict risk
'cscc_loaded_version',
'cscc_clean_revisions',
'cscc_clean_drafts',
'cscc_clean_trashed',
'cscc_clean_autodrafts',
'cscc_clean_transients',
'cscc_clean_orphan_post',
'cscc_clean_orphan_user',
'cscc_clean_spam_comments',
'cscc_clean_trash_comments',
'cscc_post_revisions_age',
'cscc_trash_age',
'cscc_drafts_age',
'cscc_autodraft_age',
'cscc_spam_comments_age',
'cscc_trash_comments_age',
'cscc_schedule_db_enabled',
'cscc_schedule_db_days',
'cscc_schedule_db_hour',
'cscc_schedule_img_enabled',
'cscc_schedule_img_days',
'cscc_schedule_img_hour',
'cscc_img_max_width',
'cscc_img_max_height',
'cscc_img_quality',
'cscc_convert_png_to_jpg',
'cspj_chunk_mb',
// Runtime data.
'cscc_last_db_cleanup',
'cscc_last_img_cleanup',
'cscc_last_img_optimise',
'cscc_last_scheduled_db_cleanup',
'cscc_last_scheduled_img_cleanup',
'cscc_total_png_conversions',
'cscc_health_hourly_metrics',
'cscc_health_weekly_snapshots',
// Cron management data.
'cscc_cron_run_log',
'cscc_cron_recycle_bin',
];
foreach ( $options as $option ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- file-scope variables in uninstall.php only; no namespace conflict risk
delete_option( $option );
}
// Clear scheduled cron events.
wp_clear_scheduled_hook( 'cscc_scheduled_db_cleanup' );
wp_clear_scheduled_hook( 'cscc_scheduled_img_cleanup' );
wp_clear_scheduled_hook( 'cspj_cleanup_chunks' );
wp_clear_scheduled_hook( 'cscc_health_hourly_collect' );
wp_clear_scheduled_hook( 'cscc_health_weekly_snapshot' );