| 1 |
<?php |
| 2 |
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
| 3 |
exit; |
| 4 |
} |
| 5 |
|
| 6 |
// Check if the user has selected removing all plugin data from the database after uninstalling the plugin - defaults to 0 (false) |
| 7 |
$basic_auth_remove_data = get_option( 'basic_auth_plugin_remove_data_after_uninstall', '0' ); |
| 8 |
|
| 9 |
if ( $basic_auth_remove_data === '1' ) { |
| 10 |
global $wpdb; |
| 11 |
|
| 12 |
// Le opzioni del plugin non condividono tutte lo stesso prefisso: il log degli accessi |
| 13 |
// si chiama basic_auth_failure_logs e con il solo LIKE 'basic_auth_plugin_%' restava |
| 14 |
// nel database dopo la disinstallazione. |
| 15 |
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching |
| 16 |
$wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE 'basic_auth_%'"); |
| 17 |
} |