| 1 |
<?php |
| 2 |
/** |
| 3 |
* Author: Alin Marcu |
| 4 |
* Author URI: https://deconf.com |
| 5 |
* Copyright 2013 Alin Marcu |
| 6 |
* License: GPLv2 or later |
| 7 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html |
| 8 |
*/ |
| 9 |
// Exit if accessed directly |
| 10 |
if ( ! defined( 'ABSPATH' ) ) |
| 11 |
exit(); |
| 12 |
|
| 13 |
class CAWP_Uninstall { |
| 14 |
|
| 15 |
public static function uninstall() { |
| 16 |
global $wpdb; |
| 17 |
$cawp = CAWP(); |
| 18 |
if ( is_multisite() ) { // Cleanup Network install |
| 19 |
foreach ( CAWP_Tools::get_sites( array( 'number' => apply_filters( 'cawp_sites_limit', 100 ) ) ) as $blog ) { |
| 20 |
switch_to_blog( $blog['blog_id'] ); |
| 21 |
$sqlquery = $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE '%%cawp_cache_%%'" ); |
| 22 |
delete_option( 'cawp_options' ); |
| 23 |
restore_current_blog(); |
| 24 |
} |
| 25 |
delete_site_option( 'cawp_network_options' ); |
| 26 |
} else { // Cleanup Single install |
| 27 |
$sqlquery = $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE '%%cawp_cache_%%'" ); |
| 28 |
delete_option( 'cawp_options' ); |
| 29 |
} |
| 30 |
CAWP_Tools::unset_cookie( 'default_metric' ); |
| 31 |
CAWP_Tools::unset_cookie( 'default_dimension' ); |
| 32 |
CAWP_Tools::unset_cookie( 'default_view' ); |
| 33 |
CAWP_Tools::unset_cookie( 'default_swmetric' ); |
| 34 |
|
| 35 |
$timestamp = wp_next_scheduled( 'cawp_expired_cache_hook' ); |
| 36 |
wp_unschedule_event( $timestamp, 'cawp_expired_cache_hook' ); |
| 37 |
|
| 38 |
|
| 39 |
} |
| 40 |
} |
| 41 |
|