function sns_backup_uninstall()
{
    //drop sns backup plugins tables
    global $wpdb;
    $table = SNS_DB_PREFIX . 'settings_destinations';
    $wpdb->query("DROP TABLE IF EXISTS `{$table}`");
    $table = SNS_DB_PREFIX . 'settings_notifications';
    $wpdb->query("DROP TABLE IF EXISTS `{$table}`");
    $table = SNS_DB_PREFIX . 'backups';
    $wpdb->query("DROP TABLE IF EXISTS `{$table}`");
    $table = SNS_DB_PREFIX . 'options';
    $wpdb->query("DROP TABLE IF EXISTS `{$table}`");
    $table = SNS_DB_PREFIX . 'schedule_config';
    $wpdb->query("DROP TABLE IF EXISTS `{$table}`");
    $table = SNS_DB_PREFIX . 'settings_ftp';
    $wpdb->query("DROP TABLE IF EXISTS `{$table}`");
    $table = SNS_DB_PREFIX . 'state';
    $wpdb->query("DROP TABLE IF EXISTS `{$table}`");
    $table = SNS_DROPBOX_TABLE;
    $wpdb->query("DROP TABLE IF EXISTS `{$table}`");
    //delete backup files
    if (is_dir(SNS_BACKUPS_PATH)) {
        Sns_History::delete_dir(SNS_BACKUPS_PATH);
    }
    delete_option('sns_backup_version');
    delete_option('sns_backup_review_off');
}
 public static function delete_by_hash($hash, $filename)
 {
     global $wpdb;
     $table = SNS_DB_PREFIX . 'backups';
     $query = " DELETE FROM `{$table}`\n                       WHERE `hash` = '{$hash}'\n                      ";
     $response = $wpdb->query($query);
     if ($response === false) {
         throw new Sns_Exception_DB_Error();
     }
     $backupFile = SNS_BACKUPS_PATH . $filename . '.zip';
     if (is_file($backupFile) && !unlink($backupFile)) {
         throw new Sns_Exception_Unavailable_Operation('Cannot delete the file ' . $backupFile);
     }
     $backupDir = SNS_BACKUPS_PATH . $filename;
     if (is_dir($backupDir)) {
         Sns_History::delete_dir($backupDir);
     }
 }