aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/AssetDataBase.cs1
-rw-r--r--OpenSim/Data/IAssetData.cs1
-rw-r--r--OpenSim/Data/MSSQL/MSSQLAssetData.cs4
-rw-r--r--OpenSim/Data/MySQL/MySQLAssetData.cs18
-rw-r--r--OpenSim/Data/SQLite/SQLiteAssetData.cs5
-rw-r--r--OpenSim/Data/SQLiteLegacy/SQLiteAssetData.cs6
-rw-r--r--OpenSim/Server/Handlers/Asset/AssetServerConnector.cs4
-rw-r--r--OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs8
-rw-r--r--OpenSim/Services/AssetService/AssetService.cs11
-rw-r--r--OpenSim/Tests/Common/Mock/MockAssetDataPlugin.cs7
-rw-r--r--bin/Robust.ini.example1
11 files changed, 60 insertions, 6 deletions
diff --git a/OpenSim/Data/AssetDataBase.cs b/OpenSim/Data/AssetDataBase.cs
index 5deb44e..e1a810c 100644
--- a/OpenSim/Data/AssetDataBase.cs
+++ b/OpenSim/Data/AssetDataBase.cs
@@ -48,5 +48,6 @@ namespace OpenSim.Data
48 public abstract void Initialise(string connect); 48 public abstract void Initialise(string connect);
49 public abstract void Initialise(); 49 public abstract void Initialise();
50 public abstract void Dispose(); 50 public abstract void Dispose();
51 public abstract bool Delete(string id);
51 } 52 }
52} 53}
diff --git a/OpenSim/Data/IAssetData.cs b/OpenSim/Data/IAssetData.cs
index 2149bca..90d5eeb 100644
--- a/OpenSim/Data/IAssetData.cs
+++ b/OpenSim/Data/IAssetData.cs
@@ -38,6 +38,7 @@ namespace OpenSim.Data
38 bool ExistsAsset(UUID uuid); 38 bool ExistsAsset(UUID uuid);
39 List<AssetMetadata> FetchAssetMetadataSet(int start, int count); 39 List<AssetMetadata> FetchAssetMetadataSet(int start, int count);
40 void Initialise(string connect); 40 void Initialise(string connect);
41 bool Delete(string id);
41 } 42 }
42 43
43 public class AssetDataInitialiser : PluginInitialiserBase 44 public class AssetDataInitialiser : PluginInitialiserBase
diff --git a/OpenSim/Data/MSSQL/MSSQLAssetData.cs b/OpenSim/Data/MSSQL/MSSQLAssetData.cs
index d6ea262..8475b22 100644
--- a/OpenSim/Data/MSSQL/MSSQLAssetData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLAssetData.cs
@@ -322,6 +322,10 @@ namespace OpenSim.Data.MSSQL
322 return retList; 322 return retList;
323 } 323 }
324 324
325 public override bool Delete(string id)
326 {
327 return false;
328 }
325 #endregion 329 #endregion
326 } 330 }
327} 331}
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs
index 5a2af4f..35eed56 100644
--- a/OpenSim/Data/MySQL/MySQLAssetData.cs
+++ b/OpenSim/Data/MySQL/MySQLAssetData.cs
@@ -338,6 +338,24 @@ namespace OpenSim.Data.MySQL
338 return retList; 338 return retList;
339 } 339 }
340 340
341 public override bool Delete(string id)
342 {
343 lock (m_dbLock)
344 {
345 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
346 {
347 dbcon.Open();
348 MySqlCommand cmd = new MySqlCommand("delete from assets where id=?id");
349 cmd.Parameters.AddWithValue("?id", id);
350 cmd.ExecuteNonQuery();
351
352 cmd.Dispose();
353 }
354 }
355
356 return true;
357 }
358
341 #endregion 359 #endregion
342 } 360 }
343} 361}
diff --git a/OpenSim/Data/SQLite/SQLiteAssetData.cs b/OpenSim/Data/SQLite/SQLiteAssetData.cs
index 636bf86..9b938fa 100644
--- a/OpenSim/Data/SQLite/SQLiteAssetData.cs
+++ b/OpenSim/Data/SQLite/SQLiteAssetData.cs
@@ -338,6 +338,11 @@ namespace OpenSim.Data.SQLite
338 get { return "SQLite Asset storage engine"; } 338 get { return "SQLite Asset storage engine"; }
339 } 339 }
340 340
341 public override bool Delete(string id)
342 {
343 return false;
344 }
345
341 #endregion 346 #endregion
342 } 347 }
343} 348}
diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteAssetData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteAssetData.cs
index 0d63dea..df50902 100644
--- a/OpenSim/Data/SQLiteLegacy/SQLiteAssetData.cs
+++ b/OpenSim/Data/SQLiteLegacy/SQLiteAssetData.cs
@@ -338,6 +338,10 @@ namespace OpenSim.Data.SQLiteLegacy
338 get { return "SQLite Asset storage engine"; } 338 get { return "SQLite Asset storage engine"; }
339 } 339 }
340 340
341 public override bool Delete(string id)
342 {
343 return false;
344 }
341 #endregion 345 #endregion
342 } 346 }
343} \ No newline at end of file 347}
diff --git a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs
index f7eb292..b6425f4 100644
--- a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs
+++ b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs
@@ -59,9 +59,11 @@ namespace OpenSim.Server.Handlers.Asset
59 m_AssetService = 59 m_AssetService =
60 ServerUtils.LoadPlugin<IAssetService>(assetService, args); 60 ServerUtils.LoadPlugin<IAssetService>(assetService, args);
61 61
62 bool allowDelete = serverConfig.GetBoolean("AllowRemoteDelete", false);
63
62 server.AddStreamHandler(new AssetServerGetHandler(m_AssetService)); 64 server.AddStreamHandler(new AssetServerGetHandler(m_AssetService));
63 server.AddStreamHandler(new AssetServerPostHandler(m_AssetService)); 65 server.AddStreamHandler(new AssetServerPostHandler(m_AssetService));
64 server.AddStreamHandler(new AssetServerDeleteHandler(m_AssetService)); 66 server.AddStreamHandler(new AssetServerDeleteHandler(m_AssetService, allowDelete));
65 } 67 }
66 } 68 }
67} 69}
diff --git a/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs b/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs
index f33bb90..8014fb5 100644
--- a/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs
+++ b/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs
@@ -47,11 +47,13 @@ namespace OpenSim.Server.Handlers.Asset
47 // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47 // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48 48
49 private IAssetService m_AssetService; 49 private IAssetService m_AssetService;
50 protected bool m_allowDelete;
50 51
51 public AssetServerDeleteHandler(IAssetService service) : 52 public AssetServerDeleteHandler(IAssetService service, bool allowDelete) :
52 base("DELETE", "/assets") 53 base("DELETE", "/assets")
53 { 54 {
54 m_AssetService = service; 55 m_AssetService = service;
56 m_allowDelete = allowDelete;
55 } 57 }
56 58
57 public override byte[] Handle(string path, Stream request, 59 public override byte[] Handle(string path, Stream request,
@@ -61,9 +63,9 @@ namespace OpenSim.Server.Handlers.Asset
61 63
62 string[] p = SplitParams(path); 64 string[] p = SplitParams(path);
63 65
64 if (p.Length > 0) 66 if (p.Length > 0 && m_allowDelete)
65 { 67 {
66 // result = m_AssetService.Delete(p[0]); 68 result = m_AssetService.Delete(p[0]);
67 } 69 }
68 70
69 XmlSerializer xs = new XmlSerializer(typeof(bool)); 71 XmlSerializer xs = new XmlSerializer(typeof(bool));
diff --git a/OpenSim/Services/AssetService/AssetService.cs b/OpenSim/Services/AssetService/AssetService.cs
index 2114933..4fc38f3 100644
--- a/OpenSim/Services/AssetService/AssetService.cs
+++ b/OpenSim/Services/AssetService/AssetService.cs
@@ -156,6 +156,17 @@ namespace OpenSim.Services.AssetService
156 156
157 public bool Delete(string id) 157 public bool Delete(string id)
158 { 158 {
159 UUID assetID;
160 if (!UUID.TryParse(id, out assetID))
161 return false;
162
163 AssetBase asset = m_Database.GetAsset(assetID);
164 if (asset == null)
165 return false;
166
167 if ((int)(asset.Flags & AssetFlags.Maptile) != 0)
168 return m_Database.Delete(id);
169
159 return false; 170 return false;
160 } 171 }
161 172
diff --git a/OpenSim/Tests/Common/Mock/MockAssetDataPlugin.cs b/OpenSim/Tests/Common/Mock/MockAssetDataPlugin.cs
index cc1dfbf..4a15cf2 100644
--- a/OpenSim/Tests/Common/Mock/MockAssetDataPlugin.cs
+++ b/OpenSim/Tests/Common/Mock/MockAssetDataPlugin.cs
@@ -60,5 +60,10 @@ namespace OpenSim.Tests.Common.Mock
60 } 60 }
61 61
62 public List<AssetMetadata> FetchAssetMetadataSet(int start, int count) { return new List<AssetMetadata>(count); } 62 public List<AssetMetadata> FetchAssetMetadataSet(int start, int count) { return new List<AssetMetadata>(count); }
63
64 public bool Delete(string id)
65 {
66 return false;
67 }
63 } 68 }
64} \ No newline at end of file 69}
diff --git a/bin/Robust.ini.example b/bin/Robust.ini.example
index 502a8e6..f1b9126 100644
--- a/bin/Robust.ini.example
+++ b/bin/Robust.ini.example
@@ -40,6 +40,7 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
40 LocalServiceModule = "OpenSim.Services.AssetService.dll:AssetService" 40 LocalServiceModule = "OpenSim.Services.AssetService.dll:AssetService"
41 DefaultAssetLoader = "OpenSim.Framework.AssetLoader.Filesystem.dll" 41 DefaultAssetLoader = "OpenSim.Framework.AssetLoader.Filesystem.dll"
42 AssetLoaderArgs = "assets/AssetSets.xml" 42 AssetLoaderArgs = "assets/AssetSets.xml"
43 AllowRemoteDelete = "false"
43 44
44; * This configuration loads the inventory server modules. It duplicates 45; * This configuration loads the inventory server modules. It duplicates
45; * the function of the legacy inventory server 46; * the function of the legacy inventory server