diff options
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs | 45 |
1 files changed, 35 insertions, 10 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs index c039b5a..b5272ad 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs | |||
@@ -46,6 +46,11 @@ 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 | /// <summary> | ||
50 | /// Determine whether this archive will save assets. Default is true. | ||
51 | /// </summary> | ||
52 | public bool SaveAssets { get; set; } | ||
53 | |||
49 | /// <value> | 54 | /// <value> |
50 | /// Used to select all inventory nodes in a folder but not the folder itself | 55 | /// Used to select all inventory nodes in a folder but not the folder itself |
51 | /// </value> | 56 | /// </value> |
@@ -112,6 +117,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
112 | m_invPath = invPath; | 117 | m_invPath = invPath; |
113 | m_saveStream = saveStream; | 118 | m_saveStream = saveStream; |
114 | m_assetGatherer = new UuidGatherer(m_scene.AssetService); | 119 | m_assetGatherer = new UuidGatherer(m_scene.AssetService); |
120 | |||
121 | SaveAssets = true; | ||
115 | } | 122 | } |
116 | 123 | ||
117 | protected void ReceivedAllAssets(ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids) | 124 | protected void ReceivedAllAssets(ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids) |
@@ -150,7 +157,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
150 | string serialization = UserInventoryItemSerializer.Serialize(inventoryItem, options, userAccountService); | 157 | string serialization = UserInventoryItemSerializer.Serialize(inventoryItem, options, userAccountService); |
151 | m_archiveWriter.WriteFile(filename, serialization); | 158 | m_archiveWriter.WriteFile(filename, serialization); |
152 | 159 | ||
153 | m_assetGatherer.GatherAssetUuids(inventoryItem.AssetID, (AssetType)inventoryItem.AssetType, m_assetUuids); | 160 | if (SaveAssets) |
161 | m_assetGatherer.GatherAssetUuids(inventoryItem.AssetID, (AssetType)inventoryItem.AssetType, m_assetUuids); | ||
154 | } | 162 | } |
155 | 163 | ||
156 | /// <summary> | 164 | /// <summary> |
@@ -195,6 +203,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
195 | /// </summary> | 203 | /// </summary> |
196 | public void Execute(Dictionary<string, object> options, IUserAccountService userAccountService) | 204 | public void Execute(Dictionary<string, object> options, IUserAccountService userAccountService) |
197 | { | 205 | { |
206 | if (options.ContainsKey("noassets") && (bool)options["noassets"]) | ||
207 | SaveAssets = false; | ||
208 | |||
198 | try | 209 | try |
199 | { | 210 | { |
200 | InventoryFolderBase inventoryFolder = null; | 211 | InventoryFolderBase inventoryFolder = null; |
@@ -285,12 +296,23 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
285 | 296 | ||
286 | // Don't put all this profile information into the archive right now. | 297 | // Don't put all this profile information into the archive right now. |
287 | //SaveUsers(); | 298 | //SaveUsers(); |
288 | 299 | ||
289 | new AssetsRequest( | 300 | if (SaveAssets) |
290 | new AssetsArchiver(m_archiveWriter), | 301 | { |
291 | m_assetUuids, m_scene.AssetService, | 302 | m_log.DebugFormat("[INVENTORY ARCHIVER]: Saving {0} assets for items", m_assetUuids.Count); |
292 | m_scene.UserAccountService, m_scene.RegionInfo.ScopeID, | 303 | |
293 | options, ReceivedAllAssets).Execute(); | 304 | new AssetsRequest( |
305 | new AssetsArchiver(m_archiveWriter), | ||
306 | m_assetUuids, m_scene.AssetService, | ||
307 | m_scene.UserAccountService, m_scene.RegionInfo.ScopeID, | ||
308 | options, ReceivedAllAssets).Execute(); | ||
309 | } | ||
310 | else | ||
311 | { | ||
312 | m_log.DebugFormat("[INVENTORY ARCHIVER]: Not saving assets since --noassets was specified"); | ||
313 | |||
314 | ReceivedAllAssets(new List<UUID>(), new List<UUID>()); | ||
315 | } | ||
294 | } | 316 | } |
295 | catch (Exception) | 317 | catch (Exception) |
296 | { | 318 | { |
@@ -387,19 +409,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
387 | /// </summary> | 409 | /// </summary> |
388 | /// <param name="options"></param> | 410 | /// <param name="options"></param> |
389 | /// <returns></returns> | 411 | /// <returns></returns> |
390 | public static string CreateControlFile(Dictionary<string, object> options) | 412 | public string CreateControlFile(Dictionary<string, object> options) |
391 | { | 413 | { |
392 | int majorVersion, minorVersion; | 414 | int majorVersion, minorVersion; |
393 | 415 | ||
394 | if (options.ContainsKey("profile")) | 416 | if (options.ContainsKey("profile")) |
395 | { | 417 | { |
396 | majorVersion = 1; | 418 | majorVersion = 1; |
397 | minorVersion = 1; | 419 | minorVersion = 2; |
398 | } | 420 | } |
399 | else | 421 | else |
400 | { | 422 | { |
401 | majorVersion = 0; | 423 | majorVersion = 0; |
402 | minorVersion = 2; | 424 | minorVersion = 3; |
403 | } | 425 | } |
404 | 426 | ||
405 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Creating version {0}.{1} IAR", majorVersion, minorVersion); | 427 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Creating version {0}.{1} IAR", majorVersion, minorVersion); |
@@ -411,6 +433,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
411 | xtw.WriteStartElement("archive"); | 433 | xtw.WriteStartElement("archive"); |
412 | xtw.WriteAttributeString("major_version", majorVersion.ToString()); | 434 | xtw.WriteAttributeString("major_version", majorVersion.ToString()); |
413 | xtw.WriteAttributeString("minor_version", minorVersion.ToString()); | 435 | xtw.WriteAttributeString("minor_version", minorVersion.ToString()); |
436 | |||
437 | xtw.WriteElementString("assets_included", SaveAssets.ToString()); | ||
438 | |||
414 | xtw.WriteEndElement(); | 439 | xtw.WriteEndElement(); |
415 | 440 | ||
416 | xtw.Flush(); | 441 | xtw.Flush(); |