forked from poweredcache/powered-cache
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall.php
More file actions
52 lines (39 loc) · 1.42 KB
/
uninstall.php
File metadata and controls
52 lines (39 loc) · 1.42 KB
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
<?php
/**
* Uninstall Powered Cache
* Deletes all plugin related data and configurations
*/
// Exit if accessed directly.
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit;
}
include_once( 'powered-cache.php' );
global $powered_cache_fs;
// clean cache
powered_cache_flush();
// delete settings
delete_option( 'powered_cache_settings' );
// delete preloader runtime option, just in case
delete_option( 'powered_cache_preload_runtime_option' );
// turn off page cache
Powered_Cache_Config::factory()->define_wp_cache( false );
// delete object cache file
if ( file_exists( untrailingslashit( WP_CONTENT_DIR ) . '/object-cache.php' ) ) {
$powered_cache_fs->delete( untrailingslashit( WP_CONTENT_DIR ) . '/object-cache.php' );
}
// delete advanced cache file
if ( file_exists( untrailingslashit( WP_CONTENT_DIR ) . '/advanced-cache.php' ) ) {
$powered_cache_fs->delete( untrailingslashit( WP_CONTENT_DIR ) . '/advanced-cache.php' );
}
// delete cache directory
if ( file_exists( powered_cache_get_cache_dir() ) ) {
$powered_cache_fs->delete( powered_cache_get_cache_dir(), true );
}
// delete configuration files
if ( file_exists( WP_CONTENT_DIR . '/pc-config' ) ) {
$powered_cache_fs->delete( WP_CONTENT_DIR . '/pc-config', true );
}
// remove cron tasks
wp_clear_scheduled_hook( 'powered_cache_preload_hook' );
wp_clear_scheduled_hook( 'powered_cache_preload_child_process' );
wp_clear_scheduled_hook( 'powered_cache_purge_cache' );