function multisite_get_spaced_used($space_used)
{
global $wpdb;
// Sum the total file size (including image sizes) for all S3 attachments
$sql = "SELECT SUM( meta_value ) AS bytes_total\n\t\t\t\tFROM {$wpdb->postmeta}\n\t\t\t\tWHERE meta_key = 'wpos3_filesize_total'";
$space_used = $wpdb->get_var($sql);
// Get local upload sizes
$upload_dir = wp_upload_dir();
$space_used += get_dirsize($upload_dir['basedir']);
if ($space_used > 0) {
// Convert to bytes to MB
$space_used = $space_used / 1024 / 1024;
}
return $space_used;
}