Fix some inventory issues
parent
7b471bb21c
commit
4dbff62ef5
|
@ -308,6 +308,8 @@ namespace OpenSim.Services.InventoryService
|
|||
//
|
||||
foreach (UUID id in folderIDs)
|
||||
{
|
||||
if (!ParentIsTrash(id))
|
||||
continue;
|
||||
InventoryFolderBase f = new InventoryFolderBase();
|
||||
f.ID = id;
|
||||
PurgeFolder(f);
|
||||
|
@ -319,6 +321,9 @@ namespace OpenSim.Services.InventoryService
|
|||
|
||||
public virtual bool PurgeFolder(InventoryFolderBase folder)
|
||||
{
|
||||
if (!ParentIsTrash(folder.ID))
|
||||
return false;
|
||||
|
||||
XInventoryFolder[] subFolders = m_Database.GetFolders(
|
||||
new string[] { "parentFolderID" },
|
||||
new string[] { folder.ID.ToString() });
|
||||
|
@ -519,5 +524,29 @@ namespace OpenSim.Services.InventoryService
|
|||
|
||||
return newItem;
|
||||
}
|
||||
|
||||
private bool ParentIsTrash(UUID folderID)
|
||||
{
|
||||
XInventoryFolder[] folder = m_Database.GetFolders(new string[] {"folderID"}, new string[] {folderID.ToString()});
|
||||
if (folder.Length < 1)
|
||||
return false;
|
||||
|
||||
UUID parentFolder = folder[0].parentFolderID;
|
||||
|
||||
while (parentFolder != UUID.Zero)
|
||||
{
|
||||
XInventoryFolder[] parent = m_Database.GetFolders(new string[] {"folderID"}, new string[] {parentFolder.ToString()});
|
||||
if (parent.Length < 1)
|
||||
return false;
|
||||
|
||||
if (parent[0].type == (int)AssetType.TrashFolder)
|
||||
return true;
|
||||
if (parent[0].type == (int)AssetType.RootFolder)
|
||||
return false;
|
||||
|
||||
parentFolder = parent[0].parentFolderID;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue