-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeactivation.php
67 lines (55 loc) · 1.46 KB
/
deactivation.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
/**
* Plugin deactivation and uninstall callbacks and helpers.
*
* @package DovetailPodcasts
*/
/**
* Runs when Dovetail Podcasts is de-activated.
*
* This should clean up caches and permalinks.
*
* @return void
*/
function dovetail_podcasts_deactivation_callback() {
if ( ! dovetail_podcasts_can_load_plugin() ) {
return;
}
// Fire an action when Dovetail Podcasts is deactivating.
do_action( 'dovetail_podcasts_deactivate' );
// TODO: Flush any caches.
wp_cache_flush( 'access_token', 'dovetail_podcasts' );
delete_option( 'dovetail_podcasts_settings-authentication' );
}
/**
* Runs when Dovetail Podcasts is uninstalled.
*
* This cleans up data that Dovetail Podcasts stores.
*
* @return void
*/
function dovetail_podcasts_uninstall_callback() {
if ( ! dovetail_podcasts_can_load_plugin() ) {
return;
}
// Fire an action when Dovetail Podcasts is deactivating.
do_action( 'dovetail_podcasts_uninstall' );
// Delete data during deactivation.
delete_dovetail_podcasts_data();
}
/**
* Delete plugin data.
*
* @return void
*/
function delete_dovetail_podcasts_data() {
if ( ! class_exists( 'DovetailPodcasts' ) ) {
return;
}
// Delete all plugin settings and caches.
delete_option( 'dovetail_podcasts_key' );
delete_option( 'dovetail_podcasts_settings-authentication' );
delete_option( 'dovetail_podcasts_settings-general' );
wp_cache_delete( 'access_token', 'dovetail_podcasts' );
do_action( 'dovetail_podcasts_delete_data' );
}