PluginProbe
xSpeed Cache: AI-Powered Performance Hub with MCP, Caching & CDN / 1.0.0
xSpeed Cache: AI-Powered Performance Hub with MCP, Caching & CDN v1.0.0
1.3.3 1.3.2 1.3.1 1.3.0 1.2.4 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 All 29 releases
xspeed / uninstall.php

uninstall.php in xSpeed Cache: AI-Powered Performance Hub with MCP, Caching & CDN 1.0.0, at uninstall.php

52 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Uninstall handler — deletes options, cache, and drop-in.
4 *
5 * @package XSpeed
6 */
7
8 if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
9 exit;
10 }
11
12 xspeed_uninstall_cleanup();
13
14 /**
15 * Run all uninstall cleanup. Wrapped in a function so locals don't pollute global scope.
16 */
17 function xspeed_uninstall_cleanup() {
18 delete_option( 'xspeed_options' );
19 delete_option( 'xspeed_stats' );
20
21 if ( ! function_exists( 'WP_Filesystem' ) ) {
22 require_once ABSPATH . 'wp-admin/includes/file.php';
23 }
24 WP_Filesystem();
25 global $wp_filesystem;
26 if ( ! $wp_filesystem ) {
27 return;
28 }
29
30 $cache_dir = WP_CONTENT_DIR . '/cache/xspeed';
31 if ( $wp_filesystem->is_dir( $cache_dir ) ) {
32 $wp_filesystem->delete( $cache_dir, true );
33 }
34
35 $drop_in = WP_CONTENT_DIR . '/advanced-cache.php';
36 if ( $wp_filesystem->exists( $drop_in ) ) {
37 $contents = $wp_filesystem->get_contents( $drop_in );
38 if ( is_string( $contents ) && false !== strpos( $contents, 'XSPEED_DROPIN' ) ) {
39 $wp_filesystem->delete( $drop_in );
40 }
41 }
42
43 $wp_config = ABSPATH . 'wp-config.php';
44 if ( defined( 'WP_CACHE' ) && WP_CACHE && $wp_filesystem->is_writable( $wp_config ) ) {
45 $config = $wp_filesystem->get_contents( $wp_config );
46 if ( is_string( $config ) ) {
47 $config = preg_replace( "/define\\(\\s*['\"]WP_CACHE['\"]\\s*,\\s*true\\s*\\);\\s*\\n?/", '', $config );
48 $wp_filesystem->put_contents( $wp_config, $config, FS_CHMOD_FILE );
49 }
50 }
51 }
52