wp-maintenance-mode
Last commit date
assets
8 years ago
includes
8 years ago
languages
8 years ago
views
8 years ago
index.php
8 years ago
readme.md
8 years ago
readme.txt
8 years ago
uninstall.php
8 years ago
wp-maintenance-mode.php
8 years ago
uninstall.php
36 lines
| 1 | <?php |
| 2 | |
| 3 | // If uninstall not called from WordPress, then exit |
| 4 | if (!defined('WP_UNINSTALL_PLUGIN')) { |
| 5 | exit(); |
| 6 | } |
| 7 | |
| 8 | /** |
| 9 | * Uninstall operations |
| 10 | */ |
| 11 | function single_uninstall() { |
| 12 | // delete subscribers table |
| 13 | $GLOBALS['wpdb']->query("DROP TABLE IF EXISTS {$GLOBALS['wpdb']->prefix}wpmm_subscribers"); |
| 14 | |
| 15 | // delete options |
| 16 | delete_option('wpmm_settings'); |
| 17 | delete_option('wpmm_notice'); |
| 18 | delete_option('wpmm_version'); |
| 19 | } |
| 20 | |
| 21 | // Let's do it! |
| 22 | if (is_multisite()) { |
| 23 | single_uninstall(); |
| 24 | |
| 25 | // delete data foreach blog |
| 26 | $blogs_list = $GLOBALS['wpdb']->get_results("SELECT blog_id FROM {$GLOBALS['wpdb']->blogs}", ARRAY_A); |
| 27 | if (!empty($blogs_list)) { |
| 28 | foreach ($blogs_list as $blog) { |
| 29 | switch_to_blog($blog['blog_id']); |
| 30 | single_uninstall(); |
| 31 | restore_current_blog(); |
| 32 | } |
| 33 | } |
| 34 | } else { |
| 35 | single_uninstall(); |
| 36 | } |