Exemplo n.º 1
0
}
$slimstat_options = get_option('slimstat_options', array());
if (!empty($slimstat_options['addon_custom_db_dbuser']) && !empty($slimstat_options['addon_custom_db_dbpass']) && !empty($slimstat_options['addon_custom_db_dbname']) && !empty($slimstat_options['addon_custom_db_dbhost'])) {
    $slimstat_wpdb = new wpdb($slimstat_options['addon_custom_db_dbuser'], $slimstat_options['addon_custom_db_dbpass'], $slimstat_options['addon_custom_db_dbname'], $slimstat_options['addon_custom_db_dbhost']);
} else {
    $slimstat_wpdb = $GLOBALS['wpdb'];
}
if (function_exists('is_multisite') && is_multisite()) {
    $blogids = $GLOBALS['wpdb']->get_col($GLOBALS['wpdb']->prepare("\n\t\tSELECT blog_id\n\t\tFROM {$wpdb->blogs}\n\t\tWHERE site_id = %d\n\t\t\tAND deleted = 0\n\t\t\tAND spam = 0", $GLOBALS['wpdb']->siteid));
    foreach ($blogids as $blog_id) {
        switch_to_blog($blog_id);
        slimstat_uninstall($slimstat_wpdb);
    }
    restore_current_blog();
} else {
    slimstat_uninstall($slimstat_wpdb);
}
$slimstat_wpdb->query("DROP TABLE IF EXISTS {$GLOBALS['wpdb']->base_prefix}slim_browsers");
$slimstat_wpdb->query("DROP TABLE IF EXISTS {$GLOBALS['wpdb']->base_prefix}slim_screenres");
$slimstat_wpdb->query("DROP TABLE IF EXISTS {$GLOBALS['wpdb']->base_prefix}slim_content_info");
function slimstat_uninstall($_wpdb = '')
{
    // Goodbye data...
    $_wpdb->query("DROP TABLE IF EXISTS {$GLOBALS['wpdb']->prefix}slim_outbound");
    $_wpdb->query("DROP TABLE IF EXISTS {$GLOBALS['wpdb']->prefix}slim_stats");
    // Goodbye options...
    delete_option('slimstat_options');
    delete_option('slimstat_visit_id');
    $GLOBALS['wpdb']->query("DELETE FROM {$GLOBALS['wpdb']->prefix}usermeta WHERE meta_key LIKE '%wp-slimstat%'");
    // Remove scheduled autopurge events
    wp_clear_scheduled_hook('wp_slimstat_purge');
Exemplo n.º 2
0
}
$slimstat_options = get_option('slimstat_options', array());
if (!empty($slimstat_options['addon_custom_db_dbuser']) && !empty($slimstat_options['addon_custom_db_dbpass']) && !empty($slimstat_options['addon_custom_db_dbname']) && !empty($slimstat_options['addon_custom_db_dbhost'])) {
    $slimstat_wpdb = new wpdb($slimstat_options['addon_custom_db_dbuser'], $slimstat_options['addon_custom_db_dbpass'], $slimstat_options['addon_custom_db_dbname'], $slimstat_options['addon_custom_db_dbhost']);
} else {
    $slimstat_wpdb = $GLOBALS['wpdb'];
}
if (function_exists('is_multisite') && is_multisite()) {
    $blogids = $GLOBALS['wpdb']->get_col($GLOBALS['wpdb']->prepare("\n\t\tSELECT blog_id\n\t\tFROM {$GLOBALS['wpdb']->blogs}\n\t\tWHERE site_id = %d\n\t\t\tAND deleted = 0\n\t\t\tAND spam = 0", $GLOBALS['wpdb']->siteid));
    foreach ($blogids as $blog_id) {
        switch_to_blog($blog_id);
        slimstat_uninstall($slimstat_wpdb, $slimstat_options);
        restore_current_blog();
    }
} else {
    slimstat_uninstall($slimstat_wpdb, $slimstat_options);
}
$slimstat_wpdb->query("DROP TABLE IF EXISTS {$GLOBALS['wpdb']->base_prefix}slim_browsers");
$slimstat_wpdb->query("DROP TABLE IF EXISTS {$GLOBALS['wpdb']->base_prefix}slim_screenres");
$slimstat_wpdb->query("DROP TABLE IF EXISTS {$GLOBALS['wpdb']->base_prefix}slim_content_info");
function slimstat_uninstall($_wpdb = '', $_options = array())
{
    // Goodbye data...
    $_wpdb->query("DROP TABLE IF EXISTS {$GLOBALS['wpdb']->prefix}slim_outbound");
    $_wpdb->query("DROP TABLE IF EXISTS {$GLOBALS['wpdb']->prefix}slim_events");
    $_wpdb->query("DROP TABLE IF EXISTS {$GLOBALS['wpdb']->prefix}slim_stats");
    $_wpdb->query("DROP TABLE IF EXISTS {$GLOBALS['wpdb']->prefix}slim_stats_archive");
    $_wpdb->query("DROP TABLE IF EXISTS {$GLOBALS['wpdb']->prefix}slim_stats_3");
    $_wpdb->query("DROP TABLE IF EXISTS {$GLOBALS['wpdb']->prefix}slim_stats_archive_3");
    // Goodbye options...
    delete_option('slimstat_options');