forked from rchmura/vimeography
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuninstall.php
56 lines (46 loc) · 1.35 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
<?php
if (!defined('WP_UNINSTALL_PLUGIN'))
wp_die(__('Plugin uninstallation can not be executed in this fashion.'));
global $wpdb;
delete_option('vimeography_advanced_settings');
delete_option('vimeography_default_settings');
delete_option('vimeography_db_version');
$wpdb->query('DROP TABLE '.$wpdb->prefix.'vimeography_gallery, '.$wpdb->prefix.'vimeography_gallery_meta');
$wpdb->query('DELETE a, b
FROM
wp_options a, wp_options b
WHERE
a.option_name LIKE "_transient_vimeography_%" AND
b.option_name LIKE "_transient_timeout_vimeography_%";
');
// Hell, let's do the user a favor by cleaning up ALL stale transients.
$wpdb->query('DELETE a, b
FROM
wp_options a, wp_options b
WHERE
a.option_name LIKE "_transient_%" AND
a.option_name NOT LIKE "_transient_timeout_%" AND
b.option_name = CONCAT(
"_transient_timeout_",
SUBSTRING(
a.option_name,
CHAR_LENGTH("_transient_") + 1
)
)
AND b.option_value < UNIX_TIMESTAMP();
');
$wpdb->query('DELETE a, b
FROM
wp_options a, wp_options b
WHERE
a.option_name LIKE "_site_transient_%" AND
a.option_name NOT LIKE "_site_transient_timeout_%" AND
b.option_name = CONCAT(
"_site_transient_timeout_",
SUBSTRING(
a.option_name,
CHAR_LENGTH("_site_transient_") + 1
)
)
AND b.option_value < UNIX_TIMESTAMP()
');