forked from michelve/slm-plus
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall.php
More file actions
executable file
·42 lines (34 loc) · 1.09 KB
/
uninstall.php
File metadata and controls
executable file
·42 lines (34 loc) · 1.09 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
/**
* Runs on Uninstall of Software License Manager
*
* @package Software License Manager
* @author Michel Velis
* @license GPL-2.0+
* @link http://epikly.com
*/
if (!defined('WP_UNINSTALL_PLUGIN')) {
exit(); // Exit if accessed directly
}
if (!current_user_can('activate_plugins')) {
return;
}
global $wpdb;
// Delete Options
$slm_options = array(
'slm_db_version',
'slm_plugin_options',
);
foreach ($slm_options as $option) {
if (get_option($option)) {
delete_option($option);
}
}
// Delete Custom Post Type posts
$wpdb->query("DELETE FROM {$wpdb->posts} WHERE post_type IN ( 'slm_manage_license' );");
$wpdb->query("DELETE FROM {$wpdb->postmeta} meta LEFT JOIN {$wpdb->posts} posts ON posts.ID = meta.post_id WHERE wp.ID IS NULL;");
// Delete Tables
$wpdb->query("DROP TABLE IF EXISTS" . $wpdb->prefix . "lic_key_tbl");
$wpdb->query("DROP TABLE IF EXISTS" . $wpdb->prefix . "lic_reg_domain_tbl");
$wpdb->query("DROP TABLE IF EXISTS" . $wpdb->prefix . "lic_reg_devices_tbl");
$wpdb->query("DROP TABLE IF EXISTS" . $wpdb->prefix . "lic_log_tbl");