From 862b7753b99d3f9b4fa2e414e6d37a04b7dbec1a Mon Sep 17 00:00:00 2001 From: Stefan Van Dyck Date: Fri, 6 Sep 2024 18:50:01 +0200 Subject: [PATCH] Re-enable deleting uploads --- .../ala/spatial/ManageLayersService.groovy | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/grails-app/services/au/org/ala/spatial/ManageLayersService.groovy b/grails-app/services/au/org/ala/spatial/ManageLayersService.groovy index 3f97ae7..4ebb848 100644 --- a/grails-app/services/au/org/ala/spatial/ManageLayersService.groovy +++ b/grails-app/services/au/org/ala/spatial/ManageLayersService.groovy @@ -621,19 +621,22 @@ class ManageLayersService { } } - //raw upload - //TODO: tidy messages for id == name (layer already deleted) -// String[] result; -// result = httpCall("DELETE", -// geoserverUrl + "/rest/workspaces/ALA/datastores/" + id + "?recurse=true", ///external.shp", -// geoserverUsername, geoserverPassword, -// null,null, -// "text/plain"); -// result = httpCall("DELETE", -// geoserverUrl + "/rest/workspaces/ALA/coveragestores/" + id + "?recurse=true", //"/external.geotiff", -// geoserverUsername, geoserverPassword, -// null,null, -// "text/plain"); + //Delete raw upload + httpCall("DELETE", + geoserverUrl + "/rest/workspaces/ALA/datastores/" + id + "?recurse=true", ///external.shp", + geoserverUsername, geoserverPassword, + null, null, + "text/plain"); + httpCall("DELETE", + geoserverUrl + "/rest/workspaces/ALA/coveragestores/" + id + "?recurse=true", //"/external.geotiff", + geoserverUsername, geoserverPassword, + null, null, + "text/plain"); + + def layerDataFolder = new File(spatialConfig.data.dir.toString() + "/uploads/" + id) + if (layerDataFolder.exists()) { + FileUtils.deleteDirectory(layerDataFolder) + } } def deleteField(String fieldId) {