aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Services/InventoryService/XInventoryService.cs29
1 files changed, 29 insertions, 0 deletions
diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs
index bb24292..79afc8d 100644
--- a/OpenSim/Services/InventoryService/XInventoryService.cs
+++ b/OpenSim/Services/InventoryService/XInventoryService.cs
@@ -308,6 +308,8 @@ namespace OpenSim.Services.InventoryService
308 // 308 //
309 foreach (UUID id in folderIDs) 309 foreach (UUID id in folderIDs)
310 { 310 {
311 if (!ParentIsTrash(id))
312 continue;
311 InventoryFolderBase f = new InventoryFolderBase(); 313 InventoryFolderBase f = new InventoryFolderBase();
312 f.ID = id; 314 f.ID = id;
313 PurgeFolder(f); 315 PurgeFolder(f);
@@ -319,6 +321,9 @@ namespace OpenSim.Services.InventoryService
319 321
320 public virtual bool PurgeFolder(InventoryFolderBase folder) 322 public virtual bool PurgeFolder(InventoryFolderBase folder)
321 { 323 {
324 if (!ParentIsTrash(folder.ID))
325 return false;
326
322 XInventoryFolder[] subFolders = m_Database.GetFolders( 327 XInventoryFolder[] subFolders = m_Database.GetFolders(
323 new string[] { "parentFolderID" }, 328 new string[] { "parentFolderID" },
324 new string[] { folder.ID.ToString() }); 329 new string[] { folder.ID.ToString() });
@@ -519,5 +524,29 @@ namespace OpenSim.Services.InventoryService
519 524
520 return newItem; 525 return newItem;
521 } 526 }
527
528 private bool ParentIsTrash(UUID folderID)
529 {
530 XInventoryFolder[] folder = m_Database.GetFolders(new string[] {"folderID"}, new string[] {folderID.ToString()});
531 if (folder.Length < 1)
532 return false;
533
534 UUID parentFolder = folder[0].parentFolderID;
535
536 while (parentFolder != UUID.Zero)
537 {
538 XInventoryFolder[] parent = m_Database.GetFolders(new string[] {"folderID"}, new string[] {parentFolder.ToString()});
539 if (parent.Length < 1)
540 return false;
541
542 if (parent[0].type == (int)AssetType.TrashFolder)
543 return true;
544 if (parent[0].type == (int)AssetType.RootFolder)
545 return false;
546
547 parentFolder = parent[0].parentFolderID;
548 }
549 return false;
550 }
522 } 551 }
523} 552}