PluginProbe
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment / 2.1.23
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment v2.1.23
3.1.13 3.1.12 3.1.11 3.1.10 3.1.9 3.1.8 3.1.7 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 All 122 releases
← All changes | Inc/Core/Admin/PluginUninstall.php +15 -145 trunk2.1.23 View file →
@@ -1,12 +1,12 @@
1 1 <?php
2 2 /**
3 3 * @package FireBox
4 - * @version 3.1.13 Free
4 + * @version 2.1.23 Free
5 5 *
6 6 * @author FirePlugins <[email protected]>
7 7 * @link https://www.fireplugins.com
8 - * @copyright Copyright © 2026 FirePlugins All Rights Reserved
8 + * @copyright Copyright © 2024 FirePlugins All Rights Reserved
9 9 * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
10 10 */
11 11
12 12 namespace FireBox\Core\Admin;
@@ -21,111 +21,35 @@
21 21 class PluginUninstall extends \Uninstall
22 22 {
23 23 /**
24 24 * Runs once we uninstall the plugin.
25 - *
26 - * The uninstall hook fires once for the whole network, so on multisite this
27 - * walks every site — each holds its own tables, campaigns, options and
28 - * uploads — and applies the network's decision to all of them.
29 - *
25 + *
30 26 * @return void
31 27 */
32 28 public function start()
33 29 {
34 - if (!is_multisite())
30 + if (!$settings = get_option('firebox_settings'))
35 31 {
36 - $this->uninstallCurrentSite();
37 -
38 32 return;
39 33 }
40 -
41 - /**
42 - * One decision for the network, taken from its main site.
43 - *
44 - * Only a network administrator can delete a network plugin, and there
45 - * is no screen where they can answer this for each site. Reading it per
46 - * site sounds fairer but does not work: the setting defaults to keeping
47 - * data, so every site that never changed it would hold on to its tables
48 - * and the delete would leave the network littered with them.
49 - */
50 - $keep_data = $this->networkKeepsData();
51 -
52 - wp_raise_memory_limit('admin');
53 -
54 - foreach (get_sites(['fields' => 'ids', 'number' => 0]) as $site_id)
34 +
35 + if (isset($settings['keep_data_on_uninstall']) && $settings['keep_data_on_uninstall'] == '1')
55 36 {
56 - /**
57 - * Give each site its own slice of the clock rather than letting the
58 - * whole network share one. Without this a large network walks into
59 - * max_execution_time part way through; with it, only a single
60 - * pathological site can.
61 - *
62 - * The loop is resumable either way — a site that finished no longer
63 - * has firebox_settings, so uninstallCurrentSite() returns straight
64 - * away and a retry carries on where this left off.
65 - */
66 - if (function_exists('set_time_limit'))
67 - {
68 - @set_time_limit(30); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
69 - }
70 -
71 - switch_to_blog($site_id);
72 - $this->uninstallCurrentSite($keep_data);
73 - restore_current_blog();
74 - }
75 -
76 - $this->deleteNetworkOptions();
77 - }
78 -
79 - /**
80 - * Removes FireBox from the current site.
81 - *
82 - * Safe to call while switched: the framework resolves the table prefix from
83 - * the current site, and every option read below is a site option.
84 - *
85 - * @param bool|null $keep_data Whether to keep this site's data. Null
86 - * reads the site's own setting, which is
87 - * what a single site does.
88 - *
89 - * @return void
90 - */
91 - public function uninstallCurrentSite($keep_data = null)
92 - {
93 - // No settings means FireBox was never set up here — nothing of ours to
94 - // remove, and nothing to read a decision from.
95 - if (!$settings = get_option('firebox_settings'))
96 - {
97 37 return;
98 38 }
99 39
100 - // Disable usage tracking
101 - $tracking = new \FireBox\Core\UsageTracking\SendUsage();
102 - $tracking->stop();
40 + require_once FBOX_PLUGIN_DIR . 'Inc/Framework/Inc/Helpers/Directory.php';
41 + require_once FBOX_PLUGIN_DIR . 'Inc/Framework/Inc/Helpers/WPHelper.php';
103 42
104 - // Unschedule the log retention cleanup cron
105 - \FireBox\Core\FB\Log::unscheduleCleanup();
43 + // remove all db tables
44 + $this->pluginUninstall();
106 45
107 - if ($keep_data === null)
108 - {
109 - $keep_data = isset($settings['keep_data_on_uninstall']) && $settings['keep_data_on_uninstall'] == '1';
110 - }
46 + $this->removeCapabilities();
111 47
112 - if ($keep_data)
113 - {
114 - return;
115 - }
48 + // de-register post type
49 + unregister_post_type('firebox');
116 50
117 - require_once FBOX_PLUGIN_DIR . 'Inc/Framework/Inc/Helpers/Directory.php';
118 - require_once FBOX_PLUGIN_DIR . 'Inc/Framework/Inc/Helpers/WPHelper.php';
119 -
120 - /**
121 - * Campaigns go first, while the tables are still there.
122 - *
123 - * Deleting one fires delete_post, and our handler clears that campaign's
124 - * logs and submissions. Dropping the tables first leaves that handler
125 - * querying tables that no longer exist, which fills debug.log with
126 - * database errors on every uninstall.
127 - */
51 + // remove all custom post types data
128 52 $items = get_posts(['post_type' => 'firebox', 'post_status' => 'any', 'numberposts' => -1, 'fields' => 'ids']);
129 53
130 54 if ($items)
131 55 {
@@ -134,16 +58,8 @@
134 58 wp_delete_post($item, true);
135 59 }
136 60 }
137 61
138 - // remove all db tables
139 - $this->pluginUninstall();
140 -
141 - $this->removeCapabilities();
142 -
143 - // de-register post type
144 - unregister_post_type('firebox');
145 -
146 62 // remove all options
147 63 delete_option('firebox_version');
148 64 delete_option('firebox_settings');
149 65 delete_option('firebox_import');
@@ -148,59 +64,13 @@
148 64 delete_option('firebox_settings');
149 65 delete_option('firebox_import');
150 66 delete_option('firebox_license_status');
151 67 delete_option('firebox_license_key');
152 -
153 68
154 - delete_option('firebox_session_conditions_in_use');
155 - delete_option('firebox_boxes_cache');
156 - delete_option('firebox_onboarding_completed');
157 - delete_option('firebox_activation_redirect');
158 -
159 - // Remove first campaign timing data
160 - delete_option('firebox_first_campaign_tracking_started_at');
161 - delete_option('firebox_time_to_first_campaign_draft_seconds');
162 - delete_option('firebox_time_to_first_campaign_publish_seconds');
163 -
164 69 // Delete /wp-content/uploads/firebox directory
165 70 \FPFramework\Helpers\Directory::delete(\FPFramework\Helpers\WPHelper::getPluginUploadsDirectory('firebox'));
166 71 }
167 72
168 - /**
169 - * Whether the network is keeping its data.
170 - *
171 - * Read from the main site, which is the network's own copy of the setting.
172 - * Defaults to keeping it when there is nothing to read.
173 - *
174 - * @return bool
175 - */
176 - private function networkKeepsData()
177 - {
178 - switch_to_blog(get_main_site_id());
179 - $settings = get_option('firebox_settings');
180 - restore_current_blog();
181 -
182 - if (!is_array($settings) || !isset($settings['keep_data_on_uninstall']))
183 - {
184 - return true;
185 - }
186 -
187 - return $settings['keep_data_on_uninstall'] == '1';
188 - }
189 -
190 - /**
191 - * Removes the options FireBox keeps at network level.
192 - *
193 - * @return void
194 - */
195 - private function deleteNetworkOptions()
196 - {
197 - delete_site_option('firebox_license_key');
198 - delete_site_option('firebox_license_status');
199 - delete_site_option('firebox_network_install_offset');
200 - delete_site_option('firebox_usage_tracking_site');
201 - }
202 -
203 73 private function removeCapabilities()
204 74 {
205 75 $capabilities = \FireBox\Core\Admin\Capabilities::getCapabilities();
206 76
@@ -217,5 +87,5 @@
217 87 }
218 88 }
219 89 }
220 90 }
221 -}
91 +}