Allow deleting folders even if they're not in the Trash
The functions DeleteFolders() and PurgeFolder() still work as before, i.e. they only allow deleting folders that are in the Trash. However, the functions DeleteFoldersEx() and PurgeFolderEx() can now be used to delete any folder.0.7.4.1
parent
cccef2e56d
commit
ad23774433
|
@ -363,6 +363,11 @@ namespace OpenSim.Services.InventoryService
|
||||||
// We don't check the principal's ID here
|
// We don't check the principal's ID here
|
||||||
//
|
//
|
||||||
public virtual bool DeleteFolders(UUID principalID, List<UUID> folderIDs)
|
public virtual bool DeleteFolders(UUID principalID, List<UUID> folderIDs)
|
||||||
|
{
|
||||||
|
return DeleteFoldersEx(principalID, folderIDs, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool DeleteFoldersEx(UUID principalID, List<UUID> folderIDs, bool onlyIfTrash)
|
||||||
{
|
{
|
||||||
if (!m_AllowDelete)
|
if (!m_AllowDelete)
|
||||||
return false;
|
return false;
|
||||||
|
@ -371,11 +376,12 @@ namespace OpenSim.Services.InventoryService
|
||||||
//
|
//
|
||||||
foreach (UUID id in folderIDs)
|
foreach (UUID id in folderIDs)
|
||||||
{
|
{
|
||||||
if (!ParentIsTrash(id))
|
if (onlyIfTrash && !ParentIsTrash(id))
|
||||||
continue;
|
continue;
|
||||||
|
//m_log.InfoFormat("[XINVENTORY SERVICE]: Delete folder {0}", id);
|
||||||
InventoryFolderBase f = new InventoryFolderBase();
|
InventoryFolderBase f = new InventoryFolderBase();
|
||||||
f.ID = id;
|
f.ID = id;
|
||||||
PurgeFolder(f);
|
PurgeFolderEx(f, onlyIfTrash);
|
||||||
m_Database.DeleteFolders("folderID", id.ToString());
|
m_Database.DeleteFolders("folderID", id.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -383,11 +389,16 @@ namespace OpenSim.Services.InventoryService
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual bool PurgeFolder(InventoryFolderBase folder)
|
public virtual bool PurgeFolder(InventoryFolderBase folder)
|
||||||
|
{
|
||||||
|
return PurgeFolderEx(folder, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool PurgeFolderEx(InventoryFolderBase folder, bool onlyIfTrash)
|
||||||
{
|
{
|
||||||
if (!m_AllowDelete)
|
if (!m_AllowDelete)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!ParentIsTrash(folder.ID))
|
if (onlyIfTrash && !ParentIsTrash(folder.ID))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
XInventoryFolder[] subFolders = m_Database.GetFolders(
|
XInventoryFolder[] subFolders = m_Database.GetFolders(
|
||||||
|
@ -396,7 +407,7 @@ namespace OpenSim.Services.InventoryService
|
||||||
|
|
||||||
foreach (XInventoryFolder x in subFolders)
|
foreach (XInventoryFolder x in subFolders)
|
||||||
{
|
{
|
||||||
PurgeFolder(ConvertToOpenSim(x));
|
PurgeFolderEx(ConvertToOpenSim(x), onlyIfTrash);
|
||||||
m_Database.DeleteFolders("folderID", x.folderID.ToString());
|
m_Database.DeleteFolders("folderID", x.folderID.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue