HEX
Server: LiteSpeed
System: Linux cde2.duelhost.dk 4.18.0-553.34.1.lve.el8.x86_64 #1 SMP Thu Jan 9 16:30:32 UTC 2025 x86_64
User: dtptviut (1121)
PHP: 8.0.30
Disabled: exec,system,passthru,shell_exec,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: /home/dtptviut/domains/hyggestolen.dk/public_html/wp-content/plugins/404-to-301/uninstall.php
<?php
/**
 * Plugin uninstall handler.
 *
 * Runs when the user clicks "Delete" on the plugin in
 * `wp-admin/plugins.php`. Removes every database trace the plugin
 * leaves behind:
 *  - the v4 settings option,
 *  - the v4 custom tables (logs + redirects),
 *  - the legacy v3 `404_to_301` table and its options (in case the
 *    user uninstalls before migrating),
 *  - dismissed-notice user meta.
 *
 * Intentionally side-effect-free aside from those `DELETE`s and
 * `DROP TABLE`s — the file stays readable so audits can confirm
 * "deleting the plugin actually deletes the plugin's data".
 *
 * @package DuckDev\FourNotFour
 */

declare( strict_types = 1 );

// Exit unless the file was loaded by WordPress's uninstall handler.
defined( 'WP_UNINSTALL_PLUGIN' ) || exit;

// v4 settings option.
delete_option( '404_to_301_settings' );
delete_option( '404_to_301_has_active' );

// BerlinDB schema-version markers.
delete_option( 'wpdb_404_to_301_logs_version' );
delete_option( 'wpdb_404_to_301_redirects_version' );

// Legacy v3 options.
delete_option( 'i4t3_gnrl_options' );
delete_option( 'i4t3_activated_time' );
delete_option( 'i4t3_db_version' );
delete_option( 'i4t3_version_no' );
delete_option( 'i4t3_review_notice' );

global $wpdb;

// v4 tables.
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}404_to_301_logs" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}404_to_301_redirects" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery

// Legacy v3 table (kept around in case the user uninstalls before migrating).
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}404_to_301" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery

// Per-user dismissed-notice flags.
delete_metadata( 'user', 0, 'i4t3_review_notice_dismissed', '', true );
delete_metadata( 'user', 0, '404_to_301_review_dismissed', '', true );
delete_metadata( 'user', 0, '404_to_301_migration_dismissed', '', true );