-
Notifications
You must be signed in to change notification settings - Fork 30
/
uninstall.php
191 lines (169 loc) · 4.64 KB
/
uninstall.php
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
<?php
/**
* WP Missed Schedule (The Original)
*
* @package WordPress Plugin
* @subpackage WP Missed Schedule
* @description Uninstall Module
* @development Code in Becoming!
* @license GPLv3 or later
*
* @gnu www.gnu.org/licenses/gpl-3.0.html
* @humans humanstxt.org/Standard.html
* @indentation www.gnu.org/prep/standards/standards.html
*
* @github github.com/sLaNGjI/wp-missed-schedule
* @project slangjis.org/plugins/wp-missed-schedule
*
* @author sLaNGjIs Team
* @website slangjis.org
* @contact slangjis.org/contact
* @donate slangjis.org/donate
* @support slangjis.org/support
* @premium slangjis.org/premium
* @authtag slangjis.org/authtag
* @translation slangjis.org/translations
* @blog slangji.wordpress.com
*
* @build 2017-12-31
* @version 2018.01.31
* #revision 0
* @requires WordPress 2.7+ and PHP 5.2+ (minimum)
* @since WordPress 2.7+
* @tested WordPress 3.7+
* @updated WordPress 4.9+
* @compatible WordPress 5.0-alpha
*/
if ( ! defined( 'ABSPATH' ) ) exit;
if ( ! defined( 'WPINC' ) ) exit;
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) exit;
global $wp_version;
if ( $wp_version < 2.7 ) exit;
$hooks_names = array(
'missed_schedule',
'missed_scheduled',
'missed_scheduled_cron',
'wp_missed_schedule',
'wp_missed_scheduled',
'wp_missed_schedule_cron',
'wp_missed_scheduled_cron',
'wp_schedule_missed',
'wp_scheduled_missed',
'wp_schedule_missed_cron',
'wp_scheduled_missed_cron',
'schedule_missed',
'scheduled_missed',
'schedule_missed_cron',
'scheduled_missed_cron'
);
$options_names = array(
'missed_schedule',
'missed_scheduled',
'schedule_missed',
'scheduled_missed',
'missed_schedule_cron',
'missed_scheduled_cron',
'schedule_missed_cron',
'scheduled_missed_cron',
'missed_schedule_options',
'missed_scheduled_options',
'schedule_missed_options',
'scheduled_missed_options',
'missed_schedule_cron_options',
'missed_scheduled_cron_options',
'schedule_missed_cron_options',
'scheduled_missed_cron_options',
'wp_missed_schedule',
'wp_missed_scheduled',
'wp_schedule_missed',
'wp_scheduled_missed',
'wp_missed_schedule_cron',
'wp_missed_scheduled_cron',
'wp_schedule_missed_cron',
'wp_scheduled_missed_cron',
'wp_missed_schedule_options',
'wp_missed_scheduled_options',
'wp_schedule_missed_options',
'wp_scheduled_missed_options',
'wp_missed_schedule_cron_options',
'wp_missed_scheduled_cron_options',
'wp_schedule_missed_cron_options',
'wp_scheduled_missed_cron_options'
);
$transients_names = array(
'wp_missed_schedule',
'wp_missed_scheduled',
'timeout_wp_missed_schedule',
'timeout_wp_missed_scheduled',
'wp_schedule_missed',
'wp_scheduled_missed',
'timeout_wp_schedule_missed',
'timeout_wp_scheduled_missed',
'missed_schedule',
'missed_scheduled',
'timeout_missed_schedule',
'timeout_missed_scheduled',
'schedule_missed',
'scheduled_missed',
'timeout_schedule_missed',
'timeout_scheduled_missed'
);
if ( $wp_version >= 2.7 )
{
foreach ( $hooks_names as $hook_name )
{
wp_clear_scheduled_hook( $hook_name );
}
foreach ( $options_names as $option_name )
{
delete_option( $option_name );
}
}
if ( $wp_version >= 2.8 )
{
foreach ( $transients_names as $transient_name )
{
delete_transient( $transient_name );
}
}
if ( $wp_version >= 3.0 )
{
flush_rewrite_rules();
if ( is_multisite() )
{
foreach ( $hooks_names as $hook_name )
{
wp_clear_scheduled_hook( $hook_name );
}
foreach ( $options_names as $option_name )
{
delete_site_option( $option_name );
}
foreach ( $transients_names as $transient_name )
{
delete_site_transient( $transient_name );
}
global $wpdb;
$blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" );
$original_blog_id = get_current_blog_id();
foreach ( $blog_ids as $blog_id )
{
switch_to_blog( $blog_id );
foreach ( $hooks_names as $hook_name )
{
wp_clear_scheduled_hook( $hook_name );
}
foreach ( $options_names as $option_name )
{
delete_option( $option_name );
delete_site_option( $option_name );
}
foreach ( $transients_names as $transient_name )
{
delete_transient( $transient_name );
delete_site_transient( $transient_name );
}
}
switch_to_blog( $original_blog_id );
}
}