diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs | 50 |
1 files changed, 40 insertions, 10 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs index 7b4a9eb..499c552 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs | |||
@@ -55,7 +55,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
55 | 55 | ||
56 | private InventoryArchiverModule m_module; | 56 | private InventoryArchiverModule m_module; |
57 | private CachedUserInfo m_userInfo; | 57 | private CachedUserInfo m_userInfo; |
58 | private string m_invPath; | 58 | private string m_invPath; |
59 | protected TarArchiveWriter m_archiveWriter; | 59 | protected TarArchiveWriter m_archiveWriter; |
60 | protected UuidGatherer m_assetGatherer; | 60 | protected UuidGatherer m_assetGatherer; |
61 | 61 | ||
@@ -118,6 +118,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
118 | 118 | ||
119 | protected void ReceivedAllAssets(ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids) | 119 | protected void ReceivedAllAssets(ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids) |
120 | { | 120 | { |
121 | // We're almost done. Just need to write out the control file now | ||
122 | m_archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p1ControlFile()); | ||
123 | m_log.InfoFormat("[ARCHIVER]: Added control file to archive."); | ||
124 | |||
121 | Exception reportedException = null; | 125 | Exception reportedException = null; |
122 | bool succeeded = true; | 126 | bool succeeded = true; |
123 | 127 | ||
@@ -164,7 +168,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
164 | { | 168 | { |
165 | path += CreateArchiveFolderName(inventoryFolder); | 169 | path += CreateArchiveFolderName(inventoryFolder); |
166 | 170 | ||
167 | // We need to make sure that we record empty folders | 171 | // We need to make sure that we record empty folders |
168 | m_archiveWriter.WriteDir(path); | 172 | m_archiveWriter.WriteDir(path); |
169 | } | 173 | } |
170 | 174 | ||
@@ -258,7 +262,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
258 | if (maxComponentIndex >= 0 && components[maxComponentIndex] == STAR_WILDCARD) | 262 | if (maxComponentIndex >= 0 && components[maxComponentIndex] == STAR_WILDCARD) |
259 | { | 263 | { |
260 | foundStar = true; | 264 | foundStar = true; |
261 | maxComponentIndex--; | 265 | maxComponentIndex--; |
262 | } | 266 | } |
263 | 267 | ||
264 | m_invPath = String.Empty; | 268 | m_invPath = String.Empty; |
@@ -320,7 +324,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
320 | SaveInvFolder(inventoryFolder, ArchiveConstants.INVENTORY_PATH, !foundStar); | 324 | SaveInvFolder(inventoryFolder, ArchiveConstants.INVENTORY_PATH, !foundStar); |
321 | } | 325 | } |
322 | 326 | ||
323 | SaveUsers(); | 327 | // Don't put all this profile information into the archive right now. |
328 | //SaveUsers(); | ||
329 | |||
324 | new AssetsRequest( | 330 | new AssetsRequest( |
325 | new AssetsArchiver(m_archiveWriter), m_assetUuids.Keys, | 331 | new AssetsArchiver(m_archiveWriter), m_assetUuids.Keys, |
326 | m_scene.AssetService, ReceivedAllAssets).Execute(); | 332 | m_scene.AssetService, ReceivedAllAssets).Execute(); |
@@ -363,8 +369,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
363 | /// <returns></returns> | 369 | /// <returns></returns> |
364 | public static string CreateArchiveFolderName(InventoryFolderBase folder) | 370 | public static string CreateArchiveFolderName(InventoryFolderBase folder) |
365 | { | 371 | { |
366 | return CreateArchiveFolderName(folder.Name, folder.ID); | 372 | return CreateArchiveFolderName(folder.Name, folder.ID); |
367 | } | 373 | } |
368 | 374 | ||
369 | /// <summary> | 375 | /// <summary> |
370 | /// Create the archive name for a particular item. | 376 | /// Create the archive name for a particular item. |
@@ -377,7 +383,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
377 | /// <returns></returns> | 383 | /// <returns></returns> |
378 | public static string CreateArchiveItemName(InventoryItemBase item) | 384 | public static string CreateArchiveItemName(InventoryItemBase item) |
379 | { | 385 | { |
380 | return CreateArchiveItemName(item.Name, item.ID); | 386 | return CreateArchiveItemName(item.Name, item.ID); |
381 | } | 387 | } |
382 | 388 | ||
383 | /// <summary> | 389 | /// <summary> |
@@ -392,7 +398,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
392 | "{0}{1}{2}/", | 398 | "{0}{1}{2}/", |
393 | name, | 399 | name, |
394 | ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR, | 400 | ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR, |
395 | id); | 401 | id); |
396 | } | 402 | } |
397 | 403 | ||
398 | /// <summary> | 404 | /// <summary> |
@@ -400,14 +406,38 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
400 | /// </summary> | 406 | /// </summary> |
401 | /// <param name="name"></param> | 407 | /// <param name="name"></param> |
402 | /// <param name="id"></param> | 408 | /// <param name="id"></param> |
403 | /// <returns></returns> | 409 | /// <returns></returns> |
404 | public static string CreateArchiveItemName(string name, UUID id) | 410 | public static string CreateArchiveItemName(string name, UUID id) |
405 | { | 411 | { |
406 | return string.Format( | 412 | return string.Format( |
407 | "{0}{1}{2}.xml", | 413 | "{0}{1}{2}.xml", |
408 | name, | 414 | name, |
409 | ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR, | 415 | ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR, |
410 | id); | 416 | id); |
417 | } | ||
418 | |||
419 | /// <summary> | ||
420 | /// Create the control file for a 0.1 version archive | ||
421 | /// </summary> | ||
422 | /// <returns></returns> | ||
423 | public static string Create0p1ControlFile() | ||
424 | { | ||
425 | StringWriter sw = new StringWriter(); | ||
426 | XmlTextWriter xtw = new XmlTextWriter(sw); | ||
427 | xtw.Formatting = Formatting.Indented; | ||
428 | xtw.WriteStartDocument(); | ||
429 | xtw.WriteStartElement("archive"); | ||
430 | xtw.WriteAttributeString("major_version", "0"); | ||
431 | xtw.WriteAttributeString("minor_version", "1"); | ||
432 | xtw.WriteEndElement(); | ||
433 | |||
434 | xtw.Flush(); | ||
435 | xtw.Close(); | ||
436 | |||
437 | String s = sw.ToString(); | ||
438 | sw.Close(); | ||
439 | |||
440 | return s; | ||
411 | } | 441 | } |
412 | } | 442 | } |
413 | } \ No newline at end of file | 443 | } \ No newline at end of file |