-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathuninstall.php
45 lines (30 loc) · 1.29 KB
/
uninstall.php
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
43
44
45
<?php
if ( ! defined( 'ABSPATH' ) || ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit; // Exit if accessed directly
}
if ( ! defined( 'WPRUS_PLUGIN_PATH' ) ) {
define( 'WPRUS_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
}
if ( ! defined( 'WPRUS_PLUGIN_URL' ) ) {
define( 'WPRUS_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
}
if ( ! defined( 'WPRUS_PLUGIN_BASEFILE' ) ) {
define( 'WPRUS_PLUGIN_FILE', plugin_basename( __FILE__ ) );
}
require_once WPRUS_PLUGIN_PATH . 'inc/class-wprus.php';
global $wpdb;
wp_clear_scheduled_hook( 'wprus_nonce_cleanup' );
wp_clear_scheduled_hook( 'wprus_logs_cleanup' );
$option_prefix = 'wprus';
$sql = "DELETE FROM $wpdb->options WHERE `option_name` LIKE %s";
$wpdb->query( $wpdb->prepare( $sql, '%' . $option_prefix . '%' ) ); // @codingStandardsIgnoreLine
$meta_prefix = 'wprus';
$table = Wprus::get_table( 'usermeta' );
$sql = "DELETE FROM $table WHERE `meta_key` LIKE %s";
$wpdb->query( $wpdb->prepare( $sql, '%' . $meta_prefix . '%' ) ); // @codingStandardsIgnoreLine
$table = Wprus::get_table( 'wprus_nonce' );
$sql = "DROP TABLE IF EXISTS {$table};";
$wpdb->query( $sql ); // @codingStandardsIgnoreLine
$table = Wprus::get_table( 'wprus_logs' );
$sql = "DROP TABLE IF EXISTS {$table};";
$wpdb->query( $sql ); // @codingStandardsIgnoreLine