aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs61
1 files changed, 43 insertions, 18 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
index dde7533..208c49e 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
@@ -46,13 +46,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
46 { 46 {
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48 48
49 protected TarArchiveWriter m_archive;
50 protected UuidGatherer m_assetGatherer;
51 protected Dictionary<UUID, int> assetUuids = new Dictionary<UUID, int>();
52
53 private InventoryArchiverModule m_module; 49 private InventoryArchiverModule m_module;
54 private CachedUserInfo m_userInfo; 50 private CachedUserInfo m_userInfo;
55 private string m_invPath; 51 private string m_invPath;
52 protected TarArchiveWriter m_archive;
53 protected UuidGatherer m_assetGatherer;
54
55 /// <value>
56 /// Used to collect the uuids of the assets that we need to save into the archive
57 /// </value>
58 protected Dictionary<UUID, int> m_assetUuids = new Dictionary<UUID, int>();
59
60 /// <value>
61 /// Used to collect the uuids of the users that we need to save into the archive
62 /// </value>
63 protected Dictionary<UUID, int> m_userUuids = new Dictionary<UUID, int>();
56 64
57 /// <value> 65 /// <value>
58 /// The stream to which the inventory archive will be saved. 66 /// The stream to which the inventory archive will be saved.
@@ -175,19 +183,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
175 183
176 m_archive.WriteFile(filename, sw.ToString()); 184 m_archive.WriteFile(filename, sw.ToString());
177 185
178 // Record the creator of this item 186 UUID creatorId = inventoryItem.Creator;
179 CachedUserInfo creator
180 = m_module.CommsManager.UserProfileCacheService.GetUserDetails(inventoryItem.Creator);
181 187
182 if (creator != null) 188 // Record the creator of this item
183 m_log.DebugFormat( 189 m_userUuids[creatorId] = 1;
184 "[INVENTORY ARCHIVER]: Got creator {0} {1}", creator.UserProfile.Name, creator.UserProfile.ID);
185 else
186 m_log.WarnFormat(
187 "[INVENTORY ARCHIVER]: Failed to get creator profile for {0} {1}",
188 inventoryItem.Name, inventoryItem.ID);
189 190
190 m_assetGatherer.GatherAssetUuids(inventoryItem.AssetID, (AssetType)inventoryItem.AssetType, assetUuids); 191 m_assetGatherer.GatherAssetUuids(inventoryItem.AssetID, (AssetType)inventoryItem.AssetType, m_assetUuids);
191 } 192 }
192 193
193 protected void SaveInvDir(InventoryFolderImpl inventoryFolder, string path) 194 protected void SaveInvDir(InventoryFolderImpl inventoryFolder, string path)
@@ -299,6 +300,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
299 { 300 {
300 if (null == inventoryItem) 301 if (null == inventoryItem)
301 { 302 {
303 // We couldn't find the path indicated
302 m_saveStream.Close(); 304 m_saveStream.Close();
303 m_module.TriggerInventoryArchiveSaved( 305 m_module.TriggerInventoryArchiveSaved(
304 false, m_userInfo, m_invPath, m_saveStream, 306 false, m_userInfo, m_invPath, m_saveStream,
@@ -324,8 +326,31 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
324 //recurse through all dirs getting dirs and files 326 //recurse through all dirs getting dirs and files
325 SaveInvDir(inventoryFolder, ArchiveConstants.INVENTORY_PATH); 327 SaveInvDir(inventoryFolder, ArchiveConstants.INVENTORY_PATH);
326 } 328 }
327 329
328 new AssetsRequest(assetUuids.Keys, m_module.CommsManager.AssetCache, ReceivedAllAssets).Execute(); 330 SaveUsers();
331 new AssetsRequest(m_assetUuids.Keys, m_module.CommsManager.AssetCache, ReceivedAllAssets).Execute();
332 }
333
334 /// <summary>
335 /// Save information for the users that we've collected.
336 /// XXX: Doesn't actually do this yet.
337 /// </summary>
338 protected void SaveUsers()
339 {
340 m_log.InfoFormat("[INVENTORY ARCHIVER]: Saving user information for {0} users", m_userUuids.Count);
341
342 foreach (UUID creatorId in m_userUuids.Keys)
343 {
344 // Record the creator of this item
345 CachedUserInfo creator
346 = m_module.CommsManager.UserProfileCacheService.GetUserDetails(creatorId);
347
348 if (creator != null)
349 m_log.DebugFormat(
350 "[INVENTORY ARCHIVER]: Got creator {0} {1}", creator.UserProfile.Name, creator.UserProfile.ID);
351 else
352 m_log.WarnFormat("[INVENTORY ARCHIVER]: Failed to get creator profile for {0}", creatorId);
353 }
329 } 354 }
330 } 355 }
331} 356}