Completed
Push — add/remove-sync-data-on-removi... ( 7f1e72 )
by
unknown
289:12 queued 278:29
created

uninstall.php (1 issue)

Labels
Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
if (
4
	!defined( 'WP_UNINSTALL_PLUGIN' )
5
||
6
	!WP_UNINSTALL_PLUGIN
7
||
8
	dirname( WP_UNINSTALL_PLUGIN ) != dirname( plugin_basename( __FILE__ ) )
9
) {
10
	status_header( 404 );
11
	exit;
12
}
13
14
// Delete all compact options
15
delete_option( 'jetpack_options'        );
16
17
// Delete all non-compact options
18
delete_option( 'jetpack_register'       );
19
delete_option( 'jetpack_activated'      );
20
delete_option( 'jetpack_active_modules' );
21
delete_option( 'jetpack_do_activate'    );
22
23
// Delete all legacy options
24
delete_option( 'jetpack_was_activated'  );
25
delete_option( 'jetpack_auto_installed' );
26
delete_transient( 'jetpack_register'    );
27
28
// Jetpack Sync
29
/**
30
 * Remove the sync queue
31
 */
32
function jetpack_remove_sync_queue() {
33
	global $wpdb;
34
	$wpdb->query( $wpdb->prepare(
35
		"DELETE FROM $wpdb->options WHERE option_name LIKE %s", "jpsq_sync-%"
36
	);
0 ignored issues
show
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected ';', expecting ',' or ')'
Loading history...
37
}
38
39
/**
40
 * Remove the default sync settings
41
 */
42
function jetpack_remove_sync_settings() {
43
	$valid_settings = array( 'dequeue_max_bytes' => true, 'upload_max_bytes' => true, 'upload_max_rows' => true, 'sync_wait_time' => true );
44
	$settings_prefix = 'jetpack_sync_settings_';
45
	foreach( $valid_settings as $option => $value ) {
46
		delete_option( $settings_prefix . $option );
47
	}
48
}
49
50
delete_option( 'jetpack_full_sync_status' );
51
delete_option( 'jetpack_constants_sync_checksum' );
52
delete_option( 'jetpack_callables_sync_checksum' );
53
54
delete_option( 'jetpack_sync_min_wait' );
55
delete_option( 'jetpack_sync_constants_await' );
56
delete_option( 'jetpack_sync_callables_await' );
57
58
delete_transient( 'jetpack_sync_callables_await' );
59
delete_transient( 'jetpack_sync_constants_await' );
60
61
jetpack_remove_sync_settings();
62
jetpack_remove_sync_queue();