-
Notifications
You must be signed in to change notification settings - Fork 74
/
uninstall.php
31 lines (21 loc) · 1.01 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
<?php
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit;
}
if ( ! current_user_can( 'activate_plugins' ) ) {
exit;
}
global $wpdb;
require_once dirname( __FILE__ ) . '/classes/class-path.php';
$path = HM\BackUpWordPress\PATH::get_instance()->get_existing_path();
// Delete the file manifest if it exists
if ( file_exists( $path . '/.files' ) ) {
unlink( $path . '/.files' );
}
// Get all schedule options with a SELECT query and delete them.
$schedules = $wpdb->get_col( $wpdb->prepare( "SELECT option_name FROM $wpdb->options WHERE option_name LIKE %s", 'hmbkp_schedule_%' ) );
array_map( 'delete_option', $schedules );
// Remove all the options
array_map( 'delete_option', array( 'hmbkp_enable_support', 'hmbkp_plugin_version', 'hmbkp_path', 'hmbkp_default_path', 'hmbkp_upsell', 'hmbkp_notices' ) );
// Delete all transients
array_map( 'delete_transient', array( 'hmbkp_plugin_data', 'hmbkp_directory_filesizes', 'hmbkp_directory_filesize_running', 'timeout_hmbkp_wp_cron_test_beacon', 'hmbkp_wp_cron_test_beacon' ) );