diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 98285e9..31c42d8 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | |||
@@ -67,10 +67,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
67 | /// </summary> | 67 | /// </summary> |
68 | protected bool m_merge; | 68 | protected bool m_merge; |
69 | 69 | ||
70 | /// <value> | 70 | protected IInventoryService m_InventoryService; |
71 | /// We only use this to request modules | 71 | protected IAssetService m_AssetService; |
72 | /// </value> | 72 | protected IUserAccountService m_UserAccountService; |
73 | protected Scene m_scene; | ||
74 | 73 | ||
75 | /// <value> | 74 | /// <value> |
76 | /// The stream from which the inventory archive will be loaded. | 75 | /// The stream from which the inventory archive will be loaded. |
@@ -118,9 +117,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
118 | protected Dictionary<UUID, UUID> m_creatorIdForAssetId = new Dictionary<UUID, UUID>(); | 117 | protected Dictionary<UUID, UUID> m_creatorIdForAssetId = new Dictionary<UUID, UUID>(); |
119 | 118 | ||
120 | public InventoryArchiveReadRequest( | 119 | public InventoryArchiveReadRequest( |
121 | Scene scene, UserAccount userInfo, string invPath, string loadPath, bool merge) | 120 | IInventoryService inv, IAssetService assets, IUserAccountService uacc, UserAccount userInfo, string invPath, string loadPath, bool merge) |
122 | : this( | 121 | : this( |
123 | scene, | 122 | inv, |
123 | assets, | ||
124 | uacc, | ||
124 | userInfo, | 125 | userInfo, |
125 | invPath, | 126 | invPath, |
126 | new GZipStream(ArchiveHelpers.GetStream(loadPath), CompressionMode.Decompress), | 127 | new GZipStream(ArchiveHelpers.GetStream(loadPath), CompressionMode.Decompress), |
@@ -129,9 +130,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
129 | } | 130 | } |
130 | 131 | ||
131 | public InventoryArchiveReadRequest( | 132 | public InventoryArchiveReadRequest( |
132 | Scene scene, UserAccount userInfo, string invPath, Stream loadStream, bool merge) | 133 | IInventoryService inv, IAssetService assets, IUserAccountService uacc, UserAccount userInfo, string invPath, Stream loadStream, bool merge) |
133 | { | 134 | { |
134 | m_scene = scene; | 135 | m_InventoryService = inv; |
136 | m_AssetService = assets; | ||
137 | m_UserAccountService = uacc; | ||
135 | m_merge = merge; | 138 | m_merge = merge; |
136 | m_userInfo = userInfo; | 139 | m_userInfo = userInfo; |
137 | m_invPath = invPath; | 140 | m_invPath = invPath; |
@@ -162,7 +165,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
162 | 165 | ||
163 | List<InventoryFolderBase> folderCandidates | 166 | List<InventoryFolderBase> folderCandidates |
164 | = InventoryArchiveUtils.FindFoldersByPath( | 167 | = InventoryArchiveUtils.FindFoldersByPath( |
165 | m_scene.InventoryService, m_userInfo.PrincipalID, m_invPath); | 168 | m_InventoryService, m_userInfo.PrincipalID, m_invPath); |
166 | 169 | ||
167 | if (folderCandidates.Count == 0) | 170 | if (folderCandidates.Count == 0) |
168 | { | 171 | { |
@@ -297,7 +300,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
297 | string plainPath = ArchiveConstants.ExtractPlainPathFromIarPath(archivePath); | 300 | string plainPath = ArchiveConstants.ExtractPlainPathFromIarPath(archivePath); |
298 | List<InventoryFolderBase> folderCandidates | 301 | List<InventoryFolderBase> folderCandidates |
299 | = InventoryArchiveUtils.FindFoldersByPath( | 302 | = InventoryArchiveUtils.FindFoldersByPath( |
300 | m_scene.InventoryService, m_userInfo.PrincipalID, plainPath); | 303 | m_InventoryService, m_userInfo.PrincipalID, plainPath); |
301 | 304 | ||
302 | if (folderCandidates.Count != 0) | 305 | if (folderCandidates.Count != 0) |
303 | { | 306 | { |
@@ -380,7 +383,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
380 | = new InventoryFolderBase( | 383 | = new InventoryFolderBase( |
381 | newFolderId, newFolderName, m_userInfo.PrincipalID, | 384 | newFolderId, newFolderName, m_userInfo.PrincipalID, |
382 | (short)AssetType.Unknown, destFolder.ID, 1); | 385 | (short)AssetType.Unknown, destFolder.ID, 1); |
383 | m_scene.InventoryService.AddFolder(destFolder); | 386 | m_InventoryService.AddFolder(destFolder); |
384 | 387 | ||
385 | // Record that we have now created this folder | 388 | // Record that we have now created this folder |
386 | iarPathExisting += rawDirsToCreate[i] + "/"; | 389 | iarPathExisting += rawDirsToCreate[i] + "/"; |
@@ -406,7 +409,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
406 | // Don't use the item ID that's in the file | 409 | // Don't use the item ID that's in the file |
407 | item.ID = UUID.Random(); | 410 | item.ID = UUID.Random(); |
408 | 411 | ||
409 | UUID ospResolvedId = OspResolver.ResolveOspa(item.CreatorId, m_scene.UserAccountService); | 412 | UUID ospResolvedId = OspResolver.ResolveOspa(item.CreatorId, m_UserAccountService); |
410 | if (UUID.Zero != ospResolvedId) // The user exists in this grid | 413 | if (UUID.Zero != ospResolvedId) // The user exists in this grid |
411 | { | 414 | { |
412 | // m_log.DebugFormat("[INVENTORY ARCHIVER]: Found creator {0} via OSPA resolution", ospResolvedId); | 415 | // m_log.DebugFormat("[INVENTORY ARCHIVER]: Found creator {0} via OSPA resolution", ospResolvedId); |
@@ -436,7 +439,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
436 | // relying on native tar tools. | 439 | // relying on native tar tools. |
437 | m_creatorIdForAssetId[item.AssetID] = item.CreatorIdAsUuid; | 440 | m_creatorIdForAssetId[item.AssetID] = item.CreatorIdAsUuid; |
438 | 441 | ||
439 | m_scene.AddInventoryItem(item); | 442 | if (!m_InventoryService.AddItem(item)) |
443 | m_log.WarnFormat("[INVENTORY ARCHIVER]: Unable to save item {0} in folder {1}", item.Name, item.Folder); | ||
440 | 444 | ||
441 | return item; | 445 | return item; |
442 | } | 446 | } |
@@ -533,7 +537,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
533 | AssetBase asset = new AssetBase(assetId, "From IAR", assetType, UUID.Zero.ToString()); | 537 | AssetBase asset = new AssetBase(assetId, "From IAR", assetType, UUID.Zero.ToString()); |
534 | asset.Data = data; | 538 | asset.Data = data; |
535 | 539 | ||
536 | m_scene.AssetService.Store(asset); | 540 | m_AssetService.Store(asset); |
537 | 541 | ||
538 | return true; | 542 | return true; |
539 | } | 543 | } |