PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 13.6
Jetpack – WP Security, Backup, Speed, & Growth v13.6
16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 13.9.2 14.0.1 14.1.1 14.2.2 14.3.1 All 501 releases
jetpack / uninstall.php

uninstall.php in Jetpack – WP Security, Backup, Speed, & Growth 13.6, at uninstall.php

59 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Functionality that is executed when Jetpack is uninstalled via built-in WordPress commands.
4 *
5 * @package automattic/jetpack
6 */
7
8 use Automattic\Jetpack\Backup\V0004\Helper_Script_Manager;
9 use Automattic\Jetpack\Connection\Manager as Connection_Manager;
10 use Automattic\Jetpack\Sync\Sender;
11
12 /**
13 * Uninstall script for Jetpack.
14 */
15 function jetpack_uninstall() {
16 if (
17 ! defined( 'WP_UNINSTALL_PLUGIN' ) ||
18 ! WP_UNINSTALL_PLUGIN ||
19 dirname( WP_UNINSTALL_PLUGIN ) !== dirname( plugin_basename( __FILE__ ) )
20 ) {
21 status_header( 404 );
22 exit;
23 }
24
25 if ( ! defined( 'JETPACK__PLUGIN_DIR' ) ) {
26 define( 'JETPACK__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
27 }
28
29 require JETPACK__PLUGIN_DIR . 'vendor/autoload_packages.php';
30
31 if ( method_exists( Connection_Manager::class, 'is_ready_for_cleanup' ) && ! Connection_Manager::is_ready_for_cleanup( dirname( plugin_basename( __FILE__ ) ) ) ) {
32 // There are other active Jetpack plugins, no need for cleanup.
33 return;
34 }
35
36 Jetpack_Options::delete_all_known_options();
37
38 // Delete all legacy options.
39 delete_option( 'jetpack_was_activated' );
40 delete_option( 'jetpack_auto_installed' );
41 delete_option( 'jetpack_register' );
42 delete_transient( 'jetpack_register' );
43
44 // Delete sync options
45 //
46 // Do not initialize any listeners.
47 // Since all the files will be deleted.
48 // No need to try to sync anything.
49 add_filter( 'jetpack_sync_modules', '__return_empty_array', 100 );
50
51 // Jetpack Sync.
52 Sender::get_instance()->uninstall();
53
54 // Jetpack Backup: Cleanup any leftover Helper Scripts.
55 Helper_Script_Manager::delete_all_helper_scripts();
56 }
57
58 jetpack_uninstall();
59