From 678a74e4f70f0ec6bb21406b829db7ea4f5f4bfc Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 9 Nov 2009 16:42:17 +0000 Subject: Tell the user when a 'save iar' has failed because the inventory path could not be found --- .../Archiver/InventoryArchiveWriteRequest.cs | 74 ++++++---------------- 1 file changed, 21 insertions(+), 53 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs index af0b72f..6c37198 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs @@ -217,37 +217,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver InventoryItemBase inventoryItem = null; InventoryFolderBase rootFolder = m_scene.InventoryService.GetRootFolder(m_userInfo.UserProfile.ID); - // XXX: Very temporarily, drop and refetch inventory to make sure we have any newly created items in cache - // This will disappear very soon once we stop using the old cached inventory. - /* - m_userInfo.DropInventory(); - m_userInfo.FetchInventory(); - */ - - /* - if (!m_userInfo.HasReceivedInventory) - { - // If the region server has access to the user admin service (by which users are created), - // then we'll assume that it's okay to fiddle with the user's inventory even if they are not on the - // server. - // - // FIXME: FetchInventory should probably be assumed to by async anyway, since even standalones might - // use a remote inventory service, though this is vanishingly rare at the moment. - if (null == m_scene.CommsManager.UserAdminService) - { - m_log.ErrorFormat( - "[INVENTORY ARCHIVER]: Have not yet received inventory info for user {0} {1}", - m_userInfo.UserProfile.Name, m_userInfo.UserProfile.ID); - - return; - } - else - { - m_userInfo.FetchInventory(); - } - } - */ - bool foundStar = false; // Eliminate double slashes and any leading / on the path. @@ -294,34 +263,33 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver m_archiveWriter = new TarArchiveWriter(m_saveStream); - if (null == inventoryFolder) - { - if (null == inventoryItem) - { - // We couldn't find the path indicated - m_saveStream.Close(); - m_module.TriggerInventoryArchiveSaved( - m_id, false, m_userInfo, m_invPath, m_saveStream, - new Exception(string.Format("Could not find inventory entry at path {0}", m_invPath))); - return; - } - else - { - m_log.DebugFormat( - "[INVENTORY ARCHIVER]: Found item {0} {1} at {2}", - inventoryItem.Name, inventoryItem.ID, m_invPath); - - SaveInvItem(inventoryItem, ArchiveConstants.INVENTORY_PATH); - } - } - else + if (inventoryFolder != null) { m_log.DebugFormat( "[INVENTORY ARCHIVER]: Found folder {0} {1} at {2}", inventoryFolder.Name, inventoryFolder.ID, m_invPath); //recurse through all dirs getting dirs and files - SaveInvFolder(inventoryFolder, ArchiveConstants.INVENTORY_PATH, !foundStar); + SaveInvFolder(inventoryFolder, ArchiveConstants.INVENTORY_PATH, !foundStar); + } + else if (inventoryItem != null) + { + m_log.DebugFormat( + "[INVENTORY ARCHIVER]: Found item {0} {1} at {2}", + inventoryItem.Name, inventoryItem.ID, m_invPath); + + SaveInvItem(inventoryItem, ArchiveConstants.INVENTORY_PATH); + } + else + { + // We couldn't find the path indicated + m_saveStream.Close(); + string errorMessage = string.Format("Aborted save. Could not find inventory path {0}", m_invPath); + m_log.ErrorFormat("[INVENTORY ARCHIVER]: {0}", errorMessage); + m_module.TriggerInventoryArchiveSaved( + m_id, false, m_userInfo, m_invPath, m_saveStream, + new Exception(errorMessage)); + return; } // Don't put all this profile information into the archive right now. -- cgit v1.1