wordpress-plugin/mozout-connect/uninstall.php
2026-11-28 15:28:08 +02:00

23 lines
1.1 KiB
PHP

<?php
// Runs when the plugin is deleted from WordPress: removes its settings, the saved key and its table.
if (!defined('WP_UNINSTALL_PLUGIN')) {
exit;
}
foreach (array('mozout_connect_settings', 'mozout_connect_api_key', 'mozout_connect_api_key_hint', 'mozout_connect_activity_log', 'mozout_connect_db_version') as $opt) {
delete_option($opt);
}
foreach (array('mozout_connect_token_info', 'mozout_connect_domains', 'mozout_connect_email_groups', 'mozout_connect_sms_groups') as $t) {
delete_transient($t);
}
wp_clear_scheduled_hook('mozout_connect_daily_cleanup');
// Caches of the domain search, prices and help articles.
global $wpdb;
$wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE 'acc\_kb\_stale\_%' OR option_name LIKE '\_transient\_acc\_%' OR option_name LIKE '\_transient\_timeout\_acc\_%'");
// The sign-ups table keeps the proof of consent. Define MOZOUT_CONNECT_KEEP_SIGNUPS in wp-config.php to keep it.
if (!defined('MOZOUT_CONNECT_KEEP_SIGNUPS') || !MOZOUT_CONNECT_KEEP_SIGNUPS) {
global $wpdb;
$wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'mozout_connect_signups');
}