-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall.php
More file actions
28 lines (23 loc) · 938 Bytes
/
Copy pathuninstall.php
File metadata and controls
28 lines (23 loc) · 938 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
/**
* Uninstall AICOM - AI Commander for WordPress
*
* Runs when the plugin is deleted from the WordPress admin.
* Removes all plugin data: database tables and options.
*/
// Security: only run when WordPress uninstalls the plugin.
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit;
}
global $wpdb;
// Drop plugin tables.
$wpdb->query( "DROP TABLE IF EXISTS `{$wpdb->prefix}aicom_api_keys`" );
$wpdb->query( "DROP TABLE IF EXISTS `{$wpdb->prefix}aicom_logs`" );
$wpdb->query( "DROP TABLE IF EXISTS `{$wpdb->prefix}aicom_backups`" );
// Remove plugin options.
delete_option( 'aicom_db_version' );
delete_option( 'aicom_soft_lock' );
delete_option( 'aicom_hard_lock' );
// Remove any leftover transients.
$wpdb->query( "DELETE FROM `{$wpdb->options}` WHERE `option_name` LIKE '_transient_aicom_new_key_%'" );
$wpdb->query( "DELETE FROM `{$wpdb->options}` WHERE `option_name` LIKE '_transient_timeout_aicom_new_key_%'" );