forked from wp-media/backwpup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuninstall.php
37 lines (33 loc) · 1.16 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
<?php
//if uninstall not called from WordPress exit
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
die();
}
global $wpdb;
/* @var wpdb $wpdb */
//only uninstall if no BackWPup Version active
if ( ! class_exists( 'BackWPup' ) ) {
//remove roles
remove_role( 'backwpup_admin' );
remove_role( 'backwpup_helper' );
remove_role( 'backwpup_check' );
//remove capabilities to administrator role
$role = get_role( 'administrator' );
if ( is_object( $role ) && method_exists( $role, 'remove_cap' ) ) {
$role->remove_cap( 'backwpup' );
$role->remove_cap( 'backwpup_jobs' );
$role->remove_cap( 'backwpup_jobs_edit' );
$role->remove_cap( 'backwpup_jobs_start' );
$role->remove_cap( 'backwpup_backups' );
$role->remove_cap( 'backwpup_backups_download' );
$role->remove_cap( 'backwpup_backups_delete' );
$role->remove_cap( 'backwpup_logs' );
$role->remove_cap( 'backwpup_logs_delete' );
$role->remove_cap( 'backwpup_settings' );
}
//delete plugin options
if ( is_multisite() )
$wpdb->query( "DELETE FROM " . $wpdb->sitemeta . " WHERE meta_key LIKE '%backwpup_%' " );
else
$wpdb->query( "DELETE FROM " . $wpdb->options . " WHERE option_name LIKE '%backwpup_%' " );
}