diff options
author | Oren Hurvitz | 2012-04-23 18:36:36 +0300 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-05-04 20:30:46 +0100 |
commit | ad23774433b55e0cfbfc50208b247f0c3f41e8ea (patch) | |
tree | 3c79cdf88d35bed93126a92f1d137e14eb2004f4 /OpenSim/Services/InventoryService/XInventoryService.cs | |
parent | Calculate the Daylight Savings Time information sent to the viewer based on U... (diff) | |
download | opensim-SC-ad23774433b55e0cfbfc50208b247f0c3f41e8ea.zip opensim-SC-ad23774433b55e0cfbfc50208b247f0c3f41e8ea.tar.gz opensim-SC-ad23774433b55e0cfbfc50208b247f0c3f41e8ea.tar.bz2 opensim-SC-ad23774433b55e0cfbfc50208b247f0c3f41e8ea.tar.xz |
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.
Diffstat (limited to 'OpenSim/Services/InventoryService/XInventoryService.cs')
-rw-r--r-- | OpenSim/Services/InventoryService/XInventoryService.cs | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs index 0e7a358..37a6a42 100644 --- a/OpenSim/Services/InventoryService/XInventoryService.cs +++ b/OpenSim/Services/InventoryService/XInventoryService.cs | |||
@@ -364,6 +364,11 @@ namespace OpenSim.Services.InventoryService | |||
364 | // | 364 | // |
365 | public virtual bool DeleteFolders(UUID principalID, List<UUID> folderIDs) | 365 | public virtual bool DeleteFolders(UUID principalID, List<UUID> folderIDs) |
366 | { | 366 | { |
367 | return DeleteFoldersEx(principalID, folderIDs, true); | ||
368 | } | ||
369 | |||
370 | public bool DeleteFoldersEx(UUID principalID, List<UUID> folderIDs, bool onlyIfTrash) | ||
371 | { | ||
367 | if (!m_AllowDelete) | 372 | if (!m_AllowDelete) |
368 | return false; | 373 | return false; |
369 | 374 | ||
@@ -371,11 +376,12 @@ namespace OpenSim.Services.InventoryService | |||
371 | // | 376 | // |
372 | foreach (UUID id in folderIDs) | 377 | foreach (UUID id in folderIDs) |
373 | { | 378 | { |
374 | if (!ParentIsTrash(id)) | 379 | if (onlyIfTrash && !ParentIsTrash(id)) |
375 | continue; | 380 | continue; |
381 | //m_log.InfoFormat("[XINVENTORY SERVICE]: Delete folder {0}", id); | ||
376 | InventoryFolderBase f = new InventoryFolderBase(); | 382 | InventoryFolderBase f = new InventoryFolderBase(); |
377 | f.ID = id; | 383 | f.ID = id; |
378 | PurgeFolder(f); | 384 | PurgeFolderEx(f, onlyIfTrash); |
379 | m_Database.DeleteFolders("folderID", id.ToString()); | 385 | m_Database.DeleteFolders("folderID", id.ToString()); |
380 | } | 386 | } |
381 | 387 | ||
@@ -384,10 +390,15 @@ namespace OpenSim.Services.InventoryService | |||
384 | 390 | ||
385 | public virtual bool PurgeFolder(InventoryFolderBase folder) | 391 | public virtual bool PurgeFolder(InventoryFolderBase folder) |
386 | { | 392 | { |
393 | return PurgeFolderEx(folder, true); | ||
394 | } | ||
395 | |||
396 | private bool PurgeFolderEx(InventoryFolderBase folder, bool onlyIfTrash) | ||
397 | { | ||
387 | if (!m_AllowDelete) | 398 | if (!m_AllowDelete) |
388 | return false; | 399 | return false; |
389 | 400 | ||
390 | if (!ParentIsTrash(folder.ID)) | 401 | if (onlyIfTrash && !ParentIsTrash(folder.ID)) |
391 | return false; | 402 | return false; |
392 | 403 | ||
393 | XInventoryFolder[] subFolders = m_Database.GetFolders( | 404 | XInventoryFolder[] subFolders = m_Database.GetFolders( |
@@ -396,7 +407,7 @@ namespace OpenSim.Services.InventoryService | |||
396 | 407 | ||
397 | foreach (XInventoryFolder x in subFolders) | 408 | foreach (XInventoryFolder x in subFolders) |
398 | { | 409 | { |
399 | PurgeFolder(ConvertToOpenSim(x)); | 410 | PurgeFolderEx(ConvertToOpenSim(x), onlyIfTrash); |
400 | m_Database.DeleteFolders("folderID", x.folderID.ToString()); | 411 | m_Database.DeleteFolders("folderID", x.folderID.ToString()); |
401 | } | 412 | } |
402 | 413 | ||