| 1 |
<?php |
| 2 |
/** |
| 3 |
* Cleanup tasks when uninstalling 410 for WordPress. |
| 4 |
* |
| 5 |
* @package MCLV_410_Plugin |
| 6 |
*/ |
| 7 |
|
| 8 |
// Exit if accessed directly or not during uninstall. |
| 9 |
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
| 10 |
exit; |
| 11 |
} |
| 12 |
|
| 13 |
/** |
| 14 |
* Drop the plugin's custom table during uninstall. |
| 15 |
* |
| 16 |
* @return void |
| 17 |
*/ |
| 18 |
function mclv_410_remove_table() { |
| 19 |
global $wpdb; |
| 20 |
|
| 21 |
$table = esc_sql( $wpdb->prefix . '410_links' ); |
| 22 |
|
| 23 |
// Schema change is intentional during uninstall, caching does not apply here. |
| 24 |
$wpdb->query( "DROP TABLE IF EXISTS `$table`" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.SchemaChange,WordPress.DB.DirectDatabaseQuery.NoCaching,WordPress.DB.PreparedSQL.InterpolatedNotPrepared |
| 25 |
} |
| 26 |
|
| 27 |
mclv_410_remove_table(); |
| 28 |
delete_option( 'mclv_410_options_version' ); |
| 29 |
delete_option( 'mclv_410_max_404s' ); |
| 30 |
|