Files
peptide-reconstitution-calc…/uninstall.php
peptiderepo 395fdee0da fix(phpcs): suppress intentional warnings with phpcs:ignore annotations
uninstall.php: direct wpdb->query() intentional in uninstall (no caching
available); add phpcs:ignore DirectDatabaseQuery.DirectQuery and NoCaching.
class-prc-rest-controller.php get_presets(): request param required by
WP REST API callback contract; add phpcs:ignore UnusedFunctionParameter.

Agent-Session: claude/adopt-ci-20260616
2026-06-16 15:33:02 +00:00

37 lines
1.0 KiB
PHP

<?php
/**
* Uninstall handler — cleans up all plugin data.
*
* What: Removes all options and transients created by this plugin.
* Who calls it: WordPress on plugin deletion.
* Dependencies: None (standalone, no autoloader).
*
* @see ARCHITECTURE.md — Teardown section.
* @package PeptideReconstitutionCalculator
*/
declare(strict_types=1);
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit;
}
global $wpdb;
// Delete all prc_ prefixed options.
$wpdb->query( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
$wpdb->prepare(
"DELETE FROM {$wpdb->options} WHERE option_name LIKE %s",
$wpdb->esc_like( 'prc_' ) . '%'
)
);
// Delete all prc_ prefixed transients.
$wpdb->query( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
$wpdb->prepare(
"DELETE FROM {$wpdb->options} WHERE option_name LIKE %s OR option_name LIKE %s",
$wpdb->esc_like( '_transient_prc_' ) . '%',
$wpdb->esc_like( '_transient_timeout_prc_' ) . '%'
)
);