Files
zbatteandClaude Fable 5 5d2e9cb7e5 fix(instanda): hygiene pass + v1.1.0 (uninstall, notices, cron, resubmit, theme)
- F-15: uninstall now removes ALL espinstanda_* options and transients (incl. the
  encrypted password and its self-provisioned key).
- F-16: register the "Gravity Forms required" admin notice unconditionally so it is
  reachable when GF is inactive (gform_loaded never fires then).
- F-22: self-heal the daily retention cron on admin_init (matches the schema self-heal).
- F-19: re-validate the stored payload via Field_Mapper::validate_payload() before a
  resubmit (DB-tamper trust boundary).
- F-20: increment the retry count on resubmit and dispatch the previously-dead
  espinstanda_resubmit_success notification event.
- F-23: emit the theme's Form-5 date-range JS only on pages that embed a Gravity Form
  and disconnect the MutationObserver (was observing the DOM subtree forever).
- F-24: bump plugin to 1.1.0; add readme.txt changelog documenting the audit fixes and
  the required ops actions.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 16:20:10 -06:00

42 lines
1.3 KiB
PHP

<?php
/**
* Uninstall - explicit teardown of the plugin's own data. The Gravity Forms
* Add-On Framework removes its settings and feeds; we drop our transaction table
* and options. Fails safe - a teardown error never blocks uninstalling.
*
* @package ESP\Instanda
*/
declare(strict_types=1);
if (!defined('WP_UNINSTALL_PLUGIN')) {
exit;
}
try {
global $wpdb;
$table = $wpdb->prefix . 'esp_instanda_transactions';
// Table name is a trusted internal constant, not user input.
$wpdb->query("DROP TABLE IF EXISTS {$table}");
// Remove EVERY plugin option and transient - including the encrypted Test password
// and its self-provisioned key - so no recoverable secret survives uninstall.
$opt = $wpdb->esc_like('espinstanda_') . '%';
$tr = '_transient_' . $wpdb->esc_like('espinstanda_') . '%';
$trt = '_transient_timeout_' . $wpdb->esc_like('espinstanda_') . '%';
$wpdb->query($wpdb->prepare(
"DELETE FROM {$wpdb->options} WHERE option_name LIKE %s OR option_name LIKE %s OR option_name LIKE %s",
$opt,
$tr,
$trt
));
// Clear any scheduled events that may still be queued.
wp_clear_scheduled_hook('esp_instanda_cleanup');
} catch (\Throwable $e) {
if (function_exists('error_log')) {
error_log('ESP INSTANDA uninstall: ' . $e->getMessage());
}
}