-
Notifications
You must be signed in to change notification settings - Fork 2
/
uninstall.php
43 lines (39 loc) · 1.25 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
<?php
/**
* Uninstall the Duo Universal plugin
*
* Deletes persistent data from the Duo Universal plugin.
* Note that transients created by the plugin are not deleted
* and left to expire normally.
*
* @link https://duo.com/docs/wordpress
*
* @package Duo Universal
* @since 1.0.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
// if uninstall not called from WordPress exit
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit();
}
// Delete Duo credentials in wp_options
// TODO these will need to be renamed as well
delete_option( 'duoup_client_id' );
delete_option( 'duoup_client_secret' );
delete_option( 'duoup_api_host' );
delete_option( 'duoup_roles' );
delete_option( 'duoup_failmode' );
delete_option( 'duoup_xmlrpc' );
// Delete Duo credentials in wp_sitemeta
delete_site_option( 'duoup_client_id' );
delete_site_option( 'duoup_client_secret' );
delete_site_option( 'duoup_api_host' );
delete_site_option( 'duoup_roles' );
delete_site_option( 'duoup_failmode' );
delete_site_option( 'duoup_xmlrpc' );
// Delete Duo user_meta fields for all users
delete_metadata( 'user', 0, 'duo_auth_status', '', true );
delete_metadata( 'user', 0, 'duo_auth_redirect_url', '', true );
delete_metadata( 'user', 0, 'duo_auth_oidc_state', '', true );