v1.0.0
This commit is contained in:
commit
6708bbb67f
43 changed files with 8342 additions and 0 deletions
31
uninstall.php
Normal file
31
uninstall.php
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
/**
|
||||
* Fired when the plugin is uninstalled.
|
||||
*
|
||||
* Drops all plugin data only if the user has explicitly opted in via Settings.
|
||||
* By default, data is preserved.
|
||||
*
|
||||
* @package MediaRightsAudit
|
||||
*/
|
||||
|
||||
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$raw = get_option( 'robotstxt_mediaaudit_settings', array() );
|
||||
$settings = is_array( $raw ) ? $raw : array();
|
||||
$delete = ! empty( $settings['delete_on_uninstall'] );
|
||||
|
||||
if ( ! $delete ) {
|
||||
return;
|
||||
}
|
||||
|
||||
global $wpdb;
|
||||
|
||||
// Drop tables in reverse dependency order.
|
||||
$wpdb->query( "DROP TABLE IF EXISTS `{$wpdb->prefix}mra_external_results`" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery
|
||||
$wpdb->query( "DROP TABLE IF EXISTS `{$wpdb->prefix}mra_media_usage`" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery
|
||||
$wpdb->query( "DROP TABLE IF EXISTS `{$wpdb->prefix}mra_media_index`" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery
|
||||
|
||||
delete_option( 'robotstxt_mediaaudit_db_version' );
|
||||
delete_option( 'robotstxt_mediaaudit_settings' );
|
||||
Loading…
Reference in a new issue