wordpress-plugin/interweb-ao-connect/uninstall.php
2026-11-28 15:28:03 +02:00

23 lines
1.2 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('interweb_ao_connect_settings', 'interweb_ao_connect_api_key', 'interweb_ao_connect_api_key_hint', 'interweb_ao_connect_activity_log', 'interweb_ao_connect_db_version') as $opt) {
delete_option($opt);
}
foreach (array('interweb_ao_connect_token_info', 'interweb_ao_connect_domains', 'interweb_ao_connect_email_groups', 'interweb_ao_connect_sms_groups') as $t) {
delete_transient($t);
}
wp_clear_scheduled_hook('interweb_ao_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 INTERWEB_AO_CONNECT_KEEP_SIGNUPS in wp-config.php to keep it.
if (!defined('INTERWEB_AO_CONNECT_KEEP_SIGNUPS') || !INTERWEB_AO_CONNECT_KEEP_SIGNUPS) {
global $wpdb;
$wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'interweb_ao_connect_signups');
}