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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
<?php /** * Uninstall file. * * @package Hummingbird */
use Hummingbird\Core\Filesystem; use Hummingbird\Core\Logger; use Hummingbird\Core\Settings;
// If uninstall not called from WordPress exit. if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { exit(); }
if ( ! function_exists( 'is_plugin_active' ) ) { include_once ABSPATH . 'wp-admin/includes/plugin.php'; }
if ( class_exists( 'Hummingbird\\WP_Hummingbird' ) ) { return; }
if ( ! class_exists( 'Hummingbird\\Core\\Settings' ) ) { /* @noinspection PhpIncludeInspection */ include_once plugin_dir_path( __FILE__ ) . '/core/class-settings.php'; } $settings = Settings::get_settings( 'settings' );
if ( $settings['remove_settings'] ) { delete_option( 'wphb_styles_collection' ); delete_option( 'wphb_scripts_collection' );
delete_option( 'wphb_process_queue' ); delete_transient( 'wphb-minification-errors' ); delete_option( 'wphb-minify-server-errors' ); delete_option( 'wphb-minification-files-scanned' ); delete_option( 'wphb-minification-show-config_modal' );
delete_option( 'wphb_settings' ); delete_site_option( 'wphb_settings' );
delete_option( 'wphb-quick-setup' ); delete_site_option( 'wphb_version' ); delete_site_option( 'wphb_run_onboarding' );
delete_site_option( 'wphb-free-install-date' );
delete_site_option( 'wphb-gzip-api-checked' ); delete_site_option( 'wphb-caching-api-checked' );
delete_site_transient( 'wphb-uptime-remotely-enabled' );
// Clean notices. delete_option( 'wphb-notice-cache-cleaned-show' ); // per subsite. delete_site_option( 'wphb-notice-free-rated-show' ); // network wide. delete_site_option( 'wphb-cloudflare-dash-notice' ); // network wide. delete_site_option( 'wphb-cloudflare-dash-notice' ); delete_site_option( 'wphb-notice-free-deactivated-dismissed' ); delete_site_option( 'wphb-notice-free-deactivated-show' ); // Asset optimization notices. delete_option( 'wphb-notice-http2-info-show' ); delete_option( 'wphb-notice-minification-optimized-show' ); // Uptime notices. delete_site_option( 'wphb-notice-uptime-info-show' );
// Clean all cron. wp_clear_scheduled_hook( 'wphb_performance_report' ); wp_clear_scheduled_hook( 'wphb_uptime_report' ); if ( wp_next_scheduled( 'wphb_minify_clear_files' ) ) { wp_clear_scheduled_hook( 'wphb_minify_clear_files' ); } }
if ( $settings['remove_data'] ) { // Reports & data. delete_site_option( 'wphb-caching-data' ); delete_site_option( 'wphb-gzip-data' );
if ( ! class_exists( 'Hummingbird\\Core\\Filesystem' ) ) { /* @noinspection PhpIncludeInspection */ include_once plugin_dir_path( __FILE__ ) . '/core/class-filesystem.php'; }
$fs = Filesystem::instance(); if ( ! is_wp_error( $fs->status ) ) { $fs->clean_up(); }
if ( ! class_exists( 'Hummingbird\\Core\\Logger' ) ) { /* @noinspection PhpIncludeInspection */ include_once plugin_dir_path( __FILE__ ) . '/core/class-logger.php'; } Logger::cleanup(); }
|