| 1 |
<?php |
| 2 |
/** |
| 3 |
* Fired when the plugin is uninstalled (deleted), not merely deactivated. |
| 4 |
* |
| 5 |
* This is the only place that is allowed to destroy plugin data: it drops the |
| 6 |
* plugin tables and removes all stored options. Deactivation must preserve |
| 7 |
* settings and carts (see WooMailerLiteDeActivator). |
| 8 |
* |
| 9 |
* @package WooMailerlite |
| 10 |
*/ |
| 11 |
|
| 12 |
// If uninstall is not called from WordPress, abort. |
| 13 |
if (!defined('WP_UNINSTALL_PLUGIN')) { |
| 14 |
die; |
| 15 |
} |
| 16 |
|
| 17 |
// Load the autoloader and helpers (db(), migrations, options, cache) without |
| 18 |
// booting the full plugin. |
| 19 |
require_once __DIR__ . '/bootstrap.php'; |
| 20 |
|
| 21 |
// Stop any scheduled background jobs. |
| 22 |
if (function_exists('as_unschedule_all_actions')) { |
| 23 |
as_unschedule_all_actions(WooMailerLiteCartCleanupJob::class); |
| 24 |
} |
| 25 |
WooMailerLiteCache::delete('cart_cleanup_scheduled'); |
| 26 |
|
| 27 |
// Drop plugin tables and remove all stored options. |
| 28 |
WooMailerLiteMigration::rollback(); |
| 29 |
WooMailerLiteOptions::deleteAll(); |
| 30 |
delete_option('woo_mailerlite'); |
| 31 |
|