-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall.php
More file actions
34 lines (29 loc) · 1.16 KB
/
uninstall.php
File metadata and controls
34 lines (29 loc) · 1.16 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
<?php
/**
* Uninstall handler.
*
* WordPress calls this file directly when the plugin is deleted via the UI.
* We check for the user's stored preference (set in the pre-delete admin screen)
* and run the appropriate cleanup path.
*
* If no preference is stored (e.g. manual deletion), we default to minimal
* cleanup — never destructively scrub markup without explicit user consent.
*
* @package PatternSyncPro
*/
defined( 'WP_UNINSTALL_PLUGIN' ) || exit;
// Bootstrap just enough to run cleanup.
define( 'PSP_DIR', plugin_dir_path( __FILE__ ) );
define( 'PSP_CPT_OVERRIDE', '_psp_override' );
define( 'PSP_OPTION_AFFECTED_POSTS', 'psp_affected_posts' );
define( 'PSP_OPTION_VERSION', 'psp_version' );
require_once PSP_DIR . 'includes/core/class-psp-pattern-lock.php';
require_once PSP_DIR . 'includes/core/class-psp-instance-registry.php';
require_once PSP_DIR . 'includes/uninstall/class-psp-cleanup.php';
$preference = get_option( 'psp_uninstall_preference', 'minimal' );
$cleanup = new \PatternSyncPro\Uninstall\PSP_Cleanup();
if ( $preference === 'full' ) {
$cleanup->run_full_cleanup();
} else {
$cleanup->run_minimal_cleanup();
}