| 1 |
<?php |
| 2 |
|
| 3 |
if (!defined('WP_UNINSTALL_PLUGIN')) |
| 4 |
wp_die(__('Plugin uninstallation can not be executed in this fashion.')); |
| 5 |
|
| 6 |
global $wpdb; |
| 7 |
|
| 8 |
define( 'VIMEOGRAPHY_GALLERY_TABLE', $wpdb->prefix . "vimeography_gallery"); |
| 9 |
define( 'VIMEOGRAPHY_GALLERY_META_TABLE', $wpdb->prefix . "vimeography_gallery_meta"); |
| 10 |
|
| 11 |
delete_option('vimeography_advanced_settings'); |
| 12 |
delete_option('vimeography_default_settings'); |
| 13 |
delete_option('vimeography_db_version'); |
| 14 |
|
| 15 |
$wpdb->query('DROP TABLE '.VIMEOGRAPHY_GALLERY_TABLE.', '.VIMEOGRAPHY_GALLERY_META_TABLE); |
| 16 |
|
| 17 |
$wpdb->query('DELETE a, b |
| 18 |
FROM |
| 19 |
wp_options a, wp_options b |
| 20 |
WHERE |
| 21 |
a.option_name LIKE "_transient_vimeography_%" AND |
| 22 |
b.option_name LIKE "_transient_timeout_vimeography_%"; |
| 23 |
'); |
| 24 |
|
| 25 |
// Hell, let's do the user a favor by cleaning up ALL stale transients. |
| 26 |
|
| 27 |
$wpdb->query('DELETE a, b |
| 28 |
FROM |
| 29 |
wp_options a, wp_options b |
| 30 |
|
| 31 |
WHERE |
| 32 |
a.option_name LIKE "_transient_%" AND |
| 33 |
a.option_name NOT LIKE "_transient_timeout_%" AND |
| 34 |
b.option_name = CONCAT( |
| 35 |
"_transient_timeout_", |
| 36 |
SUBSTRING( |
| 37 |
a.option_name, |
| 38 |
CHAR_LENGTH("_transient_") + 1 |
| 39 |
) |
| 40 |
) |
| 41 |
AND b.option_value < UNIX_TIMESTAMP(); |
| 42 |
'); |
| 43 |
|
| 44 |
$wpdb->query('DELETE a, b |
| 45 |
FROM |
| 46 |
wp_options a, wp_options b |
| 47 |
|
| 48 |
WHERE |
| 49 |
a.option_name LIKE "_site_transient_%" AND |
| 50 |
a.option_name NOT LIKE "_site_transient_timeout_%" AND |
| 51 |
b.option_name = CONCAT( |
| 52 |
"_site_transient_timeout_", |
| 53 |
SUBSTRING( |
| 54 |
a.option_name, |
| 55 |
CHAR_LENGTH("_site_transient_") + 1 |
| 56 |
) |
| 57 |
) |
| 58 |
AND b.option_value < UNIX_TIMESTAMP() |
| 59 |
'); |