aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
diff options
context:
space:
mode:
authorDr Scofield2009-06-03 12:48:04 +0000
committerDr Scofield2009-06-03 12:48:04 +0000
commit717fd3b5b91f54113ef554799f124275d5489ea1 (patch)
tree64748d1b66ada5dc3d3a97d80547c18570d05e14 /OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
parentFrom: Chris Yeoh <yeohc@au1.ibm.com> (diff)
downloadopensim-SC_OLD-717fd3b5b91f54113ef554799f124275d5489ea1.zip
opensim-SC_OLD-717fd3b5b91f54113ef554799f124275d5489ea1.tar.gz
opensim-SC_OLD-717fd3b5b91f54113ef554799f124275d5489ea1.tar.bz2
opensim-SC_OLD-717fd3b5b91f54113ef554799f124275d5489ea1.tar.xz
From: Chris Yeoh <yeohc@au1.ibm.com>
This patch adds oar file date and time (UTC) meta data to an oar file when it is created. It also adds a unique ID, though this id does not in anyway identify the machine that the oar file was created on. When an oar file with this meta data is loaded this extra information is saved with the region settings and available via LSL through: - osLoadedCreationDate() - osLoadedCreationTime() - osLoadedCreationID() If there is no meta data these fields will be blank. Subsequent oar file loads will erase the information for the previous oar file load. Persistence has only been implemented for MySQL, the other backends need updating. Overall this allows us to much more easily identify the specific version of software that clients are using. Its very straightforward to edit the oar file to change the ID string to be something more human friendly. Included in the patch is a new file OpenSim/Data/MySQL/Resources/030_RegionStore.sql required for the MySQL DB migration. btw I had a chat with justincc about this a few weeks ago since he wrote the oar file import/export and he sounded happy to accept something that included date/time information but didn't want anything that would silently leak private information like machine names.
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs')
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs58
1 files changed, 58 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index 74904e2..e26c145 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
@@ -32,6 +32,7 @@ using System.IO.Compression;
32using System.Net; 32using System.Net;
33using System.Reflection; 33using System.Reflection;
34using System.Text; 34using System.Text;
35using System.Xml;
35using log4net; 36using log4net;
36using OpenMetaverse; 37using OpenMetaverse;
37using OpenSim.Framework; 38using OpenSim.Framework;
@@ -134,6 +135,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
134 else if (!m_merge && filePath.StartsWith(ArchiveConstants.SETTINGS_PATH)) 135 else if (!m_merge && filePath.StartsWith(ArchiveConstants.SETTINGS_PATH))
135 { 136 {
136 LoadRegionSettings(filePath, data); 137 LoadRegionSettings(filePath, data);
138 } else if (filePath == ArchiveConstants.CONTROL_FILE_PATH) {
139 LoadArchiveMetadata(filePath, data);
137 } 140 }
138 } 141 }
139 142
@@ -478,5 +481,60 @@ namespace OpenSim.Region.CoreModules.World.Archiver
478 // return new BufferedStream(file, (int) response.ContentLength); 481 // return new BufferedStream(file, (int) response.ContentLength);
479 return new BufferedStream(file, 1000000); 482 return new BufferedStream(file, 1000000);
480 } 483 }
484
485 /// <summary>
486 /// Load oar file metadata
487 /// </summary>
488 /// <param name="terrainPath"></param>
489 /// <param name="data"></param>
490 /// <returns>
491 /// true if terrain was resolved successfully, false otherwise.
492 /// </returns>
493 private bool LoadArchiveMetadata(string terrainPath, byte[] data)
494 {
495 //Create the XmlNamespaceManager.
496 NameTable nt = new NameTable();
497 XmlNamespaceManager nsmgr = new XmlNamespaceManager(nt);
498
499 // Create the XmlParserContext.
500 XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None);
501
502 XmlTextReader xtr = new XmlTextReader(m_asciiEncoding.GetString(data),
503 XmlNodeType.Document, context);
504
505
506 RegionSettings currentRegionSettings = m_scene.RegionInfo.RegionSettings;
507
508 // Loaded metadata will empty if no information exists in the archive
509 currentRegionSettings.LoadedCreationDate = "";
510 currentRegionSettings.LoadedCreationTime = "";
511 currentRegionSettings.LoadedCreationID = "";
512
513 while (xtr.Read())
514 {
515 if (xtr.NodeType == XmlNodeType.Element)
516 {
517 if (xtr.Name.ToString()=="date")
518 {
519 currentRegionSettings.LoadedCreationDate = xtr.ReadElementContentAsString();
520 }
521 else if (xtr.Name.ToString()=="time")
522 {
523 currentRegionSettings.LoadedCreationTime = xtr.ReadElementContentAsString();
524 }
525 else if (xtr.Name.ToString()=="id")
526 {
527 currentRegionSettings.LoadedCreationID = xtr.ReadElementContentAsString();
528 }
529 }
530
531 }
532 currentRegionSettings.Save();
533
534 return true;
535 }
536
537
538
481 } 539 }
482} 540}