diff options
author | Melanie Thielker | 2014-06-21 00:39:55 +0200 |
---|---|---|
committer | Melanie Thielker | 2014-06-21 00:39:55 +0200 |
commit | 159fcbf150b7da0e229b29aa7b94793484543d12 (patch) | |
tree | b8c0ff3b4c758a3fba8315b556c923ef4c02a185 /OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | |
parent | Merge commit '68c8633ba18f0a11cfc0ed04d1d0c7c59e6cec76' (diff) | |
parent | Merge branch 'master' into careminster (diff) | |
download | opensim-SC_OLD-159fcbf150b7da0e229b29aa7b94793484543d12.zip opensim-SC_OLD-159fcbf150b7da0e229b29aa7b94793484543d12.tar.gz opensim-SC_OLD-159fcbf150b7da0e229b29aa7b94793484543d12.tar.bz2 opensim-SC_OLD-159fcbf150b7da0e229b29aa7b94793484543d12.tar.xz |
Merge branch 'master' of ssh://3dhosting.de/var/git/careminster
Conflicts:
OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 659b178..5a8544e 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); |
@@ -418,7 +421,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
418 | item.CreatorId = ospResolvedId.ToString(); | 421 | item.CreatorId = ospResolvedId.ToString(); |
419 | item.CreatorData = string.Empty; | 422 | item.CreatorData = string.Empty; |
420 | } | 423 | } |
421 | else if (item.CreatorData == null || item.CreatorData == String.Empty) | 424 | else if (string.IsNullOrEmpty(item.CreatorData)) |
422 | { | 425 | { |
423 | item.CreatorId = m_userInfo.PrincipalID.ToString(); | 426 | item.CreatorId = m_userInfo.PrincipalID.ToString(); |
424 | // item.CreatorIdAsUuid = new UUID(item.CreatorId); | 427 | // item.CreatorIdAsUuid = new UUID(item.CreatorId); |
@@ -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 | } |
@@ -518,7 +522,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
518 | 522 | ||
519 | foreach (SceneObjectGroup sog in sceneObjects) | 523 | foreach (SceneObjectGroup sog in sceneObjects) |
520 | foreach (SceneObjectPart sop in sog.Parts) | 524 | foreach (SceneObjectPart sop in sog.Parts) |
521 | if (sop.CreatorData == null || sop.CreatorData == "") | 525 | if (string.IsNullOrEmpty(sop.CreatorData)) |
522 | sop.CreatorID = m_creatorIdForAssetId[assetId]; | 526 | sop.CreatorID = m_creatorIdForAssetId[assetId]; |
523 | 527 | ||
524 | if (coa != null) | 528 | if (coa != null) |
@@ -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 | } |