From 2bc19a1e23594e00e2bc812d27d4b4804b438bdf Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 26 Nov 2009 16:39:30 +0000 Subject: Resolve issue where an iar load fails to preserve original item creators See http://opensimulator.org/mantis/view.php?id=4394 This change preserves the uuid when a profile is found rather than the ospa --- .../Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | 8 ++++++++ .../Avatar/Inventory/Archiver/InventoryArchiverModule.cs | 2 +- .../Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | 9 ++++++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 8532d03..b778389 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs @@ -348,9 +348,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver UUID ospResolvedId = OspResolver.ResolveOspa(item.CreatorId, m_scene.CommsManager); if (UUID.Zero != ospResolvedId) + { item.CreatorIdAsUuid = ospResolvedId; + + // XXX: For now, don't preserve the OSPA in the creator id (which actually gets persisted to the + // database). Instead, replace with the UUID that we found. + item.CreatorId = ospResolvedId.ToString(); + } else + { item.CreatorIdAsUuid = m_userInfo.UserProfile.ID; + } item.Owner = m_userInfo.UserProfile.ID; diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index 2c0d113..ecd60bd 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs @@ -280,7 +280,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver string savePath = (cmdparams.Length > 6 ? cmdparams[6] : DEFAULT_INV_BACKUP_FILENAME); m_log.InfoFormat( - "[INVENTORY ARCHIVER]: Saving archive {0} from inventory path {1} for {2} {3}", + "[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}", savePath, invPath, firstName, lastName); Guid id = Guid.NewGuid(); diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 7927352..e4dad18 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs @@ -259,9 +259,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userInfo.UserProfile.ID, item1Name); Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1"); + +// We have to disable this check since loaded items that did find users via OSPA resolution are now only storing the +// UUID, not the OSPA itself. +// Assert.That( +// foundItem1.CreatorId, Is.EqualTo(item1.CreatorId), +// "Loaded item non-uuid creator doesn't match original"); Assert.That( - foundItem1.CreatorId, Is.EqualTo(item1.CreatorId), + foundItem1.CreatorId, Is.EqualTo(userItemCreatorUuid.ToString()), "Loaded item non-uuid creator doesn't match original"); + Assert.That( foundItem1.CreatorIdAsUuid, Is.EqualTo(userItemCreatorUuid), "Loaded item uuid creator doesn't match original"); -- cgit v1.1