<?php
namespace BwWinner;

// If uninstall not called from WordPress, then exit.
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
	exit;
}

if ( ! UNINSTALL_DROP_TABLES ) return;

require_once PLUGIN_PATH . 'includes/database/class-database.php';

// Single site.
if ( ! function_exists( 'get_sites' ) ) {
	Database\Database::drop_tables();
}

// Multisite.
$sites = get_sites( [
	'fields'            => 'ids',
	'number'            => 0,
	'update_site_cache' => false,
] );
foreach ( $sites as $site ) {
	switch_to_blog( $site );
	Database\Database::drop_tables();
	restore_current_blog();
}
