aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDr Scofield2009-06-03 12:48:04 +0000
committerDr Scofield2009-06-03 12:48:04 +0000
commit717fd3b5b91f54113ef554799f124275d5489ea1 (patch)
tree64748d1b66ada5dc3d3a97d80547c18570d05e14
parentFrom: Chris Yeoh <yeohc@au1.ibm.com> (diff)
downloadopensim-SC-717fd3b5b91f54113ef554799f124275d5489ea1.zip
opensim-SC-717fd3b5b91f54113ef554799f124275d5489ea1.tar.gz
opensim-SC-717fd3b5b91f54113ef554799f124275d5489ea1.tar.bz2
opensim-SC-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 '')
-rw-r--r--OpenSim/Data/MySQL/MySQLRegionData.cs26
-rw-r--r--OpenSim/Data/MySQL/Resources/030_RegionStore.sql7
-rw-r--r--OpenSim/Framework/RegionSettings.cs24
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs58
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs8
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs25
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs5
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs17
8 files changed, 168 insertions, 2 deletions
diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs
index 7038396..72c089e 100644
--- a/OpenSim/Data/MySQL/MySQLRegionData.cs
+++ b/OpenSim/Data/MySQL/MySQLRegionData.cs
@@ -741,7 +741,8 @@ namespace OpenSim.Data.MySQL
741 "terrain_raise_limit, terrain_lower_limit, " + 741 "terrain_raise_limit, terrain_lower_limit, " +
742 "use_estate_sun, fixed_sun, sun_position, " + 742 "use_estate_sun, fixed_sun, sun_position, " +
743 "covenant, Sandbox, sunvectorx, sunvectory, " + 743 "covenant, Sandbox, sunvectorx, sunvectory, " +
744 "sunvectorz) values ( ?RegionUUID, ?BlockTerraform, " + 744 "sunvectorz, loaded_creation_date, loaded_creation_time, " +
745 "loaded_creation_id) values ( ?RegionUUID, ?BlockTerraform, " +
745 "?BlockFly, ?AllowDamage, ?RestrictPushing, " + 746 "?BlockFly, ?AllowDamage, ?RestrictPushing, " +
746 "?AllowLandResell, ?AllowLandJoinDivide, " + 747 "?AllowLandResell, ?AllowLandJoinDivide, " +
747 "?BlockShowInSearch, ?AgentLimit, ?ObjectBonus, " + 748 "?BlockShowInSearch, ?AgentLimit, ?ObjectBonus, " +
@@ -754,12 +755,14 @@ namespace OpenSim.Data.MySQL
754 "?WaterHeight, ?TerrainRaiseLimit, " + 755 "?WaterHeight, ?TerrainRaiseLimit, " +
755 "?TerrainLowerLimit, ?UseEstateSun, ?FixedSun, " + 756 "?TerrainLowerLimit, ?UseEstateSun, ?FixedSun, " +
756 "?SunPosition, ?Covenant, ?Sandbox, " + 757 "?SunPosition, ?Covenant, ?Sandbox, " +
757 "?SunVectorX, ?SunVectorY, ?SunVectorZ)"; 758 "?SunVectorX, ?SunVectorY, ?SunVectorZ, " +
759 "?LoadedCreationDate, ?LoadedCreationTime, ?LoadedCreationID)";
758 760
759 FillRegionSettingsCommand(cmd, rs); 761 FillRegionSettingsCommand(cmd, rs);
760 762
761 ExecuteNonQuery(cmd); 763 ExecuteNonQuery(cmd);
762 cmd.Dispose(); 764 cmd.Dispose();
765
763 } 766 }
764 } 767 }
765 768
@@ -1039,6 +1042,21 @@ namespace OpenSim.Data.MySQL
1039 newSettings.SunPosition = Convert.ToDouble(row["sun_position"]); 1042 newSettings.SunPosition = Convert.ToDouble(row["sun_position"]);
1040 newSettings.Covenant = new UUID((String) row["covenant"]); 1043 newSettings.Covenant = new UUID((String) row["covenant"]);
1041 1044
1045 if (row["loaded_creation_date"] is DBNull)
1046 newSettings.LoadedCreationDate = "";
1047 else
1048 newSettings.LoadedCreationDate = (String) row["loaded_creation_date"];
1049
1050 if (row["loaded_creation_time"] is DBNull)
1051 newSettings.LoadedCreationTime = "";
1052 else
1053 newSettings.LoadedCreationTime = (String) row["loaded_creation_time"];
1054
1055 if (row["loaded_creation_id"] is DBNull)
1056 newSettings.LoadedCreationID = "";
1057 else
1058 newSettings.LoadedCreationID = (String) row["loaded_creation_id"];
1059
1042 return newSettings; 1060 return newSettings;
1043 } 1061 }
1044 1062
@@ -1357,6 +1375,10 @@ namespace OpenSim.Data.MySQL
1357 cmd.Parameters.AddWithValue("FixedSun", settings.FixedSun); 1375 cmd.Parameters.AddWithValue("FixedSun", settings.FixedSun);
1358 cmd.Parameters.AddWithValue("SunPosition", settings.SunPosition); 1376 cmd.Parameters.AddWithValue("SunPosition", settings.SunPosition);
1359 cmd.Parameters.AddWithValue("Covenant", settings.Covenant.ToString()); 1377 cmd.Parameters.AddWithValue("Covenant", settings.Covenant.ToString());
1378 cmd.Parameters.AddWithValue("LoadedCreationDate", settings.LoadedCreationDate);
1379 cmd.Parameters.AddWithValue("LoadedCreationTime", settings.LoadedCreationTime);
1380 cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID);
1381
1360 } 1382 }
1361 1383
1362 /// <summary> 1384 /// <summary>
diff --git a/OpenSim/Data/MySQL/Resources/030_RegionStore.sql b/OpenSim/Data/MySQL/Resources/030_RegionStore.sql
new file mode 100644
index 0000000..dfdcf6d
--- /dev/null
+++ b/OpenSim/Data/MySQL/Resources/030_RegionStore.sql
@@ -0,0 +1,7 @@
1BEGIN;
2
3ALTER TABLE regionsettings ADD COLUMN loaded_creation_date varchar(20) default NULL;
4ALTER TABLE regionsettings ADD COLUMN loaded_creation_time varchar(20) default NULL;
5ALTER TABLE regionsettings ADD COLUMN loaded_creation_id varchar(64) default NULL;
6
7COMMIT;
diff --git a/OpenSim/Framework/RegionSettings.cs b/OpenSim/Framework/RegionSettings.cs
index a47b919..c05cc10 100644
--- a/OpenSim/Framework/RegionSettings.cs
+++ b/OpenSim/Framework/RegionSettings.cs
@@ -560,5 +560,29 @@ namespace OpenSim.Framework
560 get { return m_Covenant; } 560 get { return m_Covenant; }
561 set { m_Covenant = value; } 561 set { m_Covenant = value; }
562 } 562 }
563
564 private String m_LoadedCreationDate;
565
566 public String LoadedCreationDate
567 {
568 get { return m_LoadedCreationDate; }
569 set { m_LoadedCreationDate = value; }
570 }
571
572 private String m_LoadedCreationTime;
573
574 public String LoadedCreationTime
575 {
576 get { return m_LoadedCreationTime; }
577 set { m_LoadedCreationTime = value; }
578 }
579
580 private String m_LoadedCreationID;
581 public String LoadedCreationID
582 {
583 get { return m_LoadedCreationID; }
584 set { m_LoadedCreationID = value; }
585 }
586
563 } 587 }
564} 588}
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}
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs
index 05b51ed..e9b24f4 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs
@@ -154,8 +154,16 @@ namespace OpenSim.Region.CoreModules.World.Archiver
154 xtw.WriteStartElement("archive"); 154 xtw.WriteStartElement("archive");
155 xtw.WriteAttributeString("major_version", "0"); 155 xtw.WriteAttributeString("major_version", "0");
156 xtw.WriteAttributeString("minor_version", "2"); 156 xtw.WriteAttributeString("minor_version", "2");
157
158 xtw.WriteStartElement("creation_info");
159 DateTime now = DateTime.UtcNow;
160 xtw.WriteElementString("date", now.ToLongDateString());
161 xtw.WriteElementString("time", now.ToLongTimeString());
162 xtw.WriteElementString("id", UUID.Random().ToString());
163 xtw.WriteEndElement();
157 xtw.WriteEndElement(); 164 xtw.WriteEndElement();
158 165
166
159 xtw.Flush(); 167 xtw.Flush();
160 xtw.Close(); 168 xtw.Close();
161 169
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index d759b77..9b65d8d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -1709,5 +1709,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1709 1709
1710 return result; 1710 return result;
1711 } 1711 }
1712
1713 public string osLoadedCreationDate()
1714 {
1715 CheckThreatLevel(ThreatLevel.Low, "osLoadedCreationDate");
1716 m_host.AddScriptLPS(1);
1717
1718 return World.RegionInfo.RegionSettings.LoadedCreationDate;
1719 }
1720
1721 public string osLoadedCreationTime()
1722 {
1723 CheckThreatLevel(ThreatLevel.Low, "osLoadedCreationTime");
1724 m_host.AddScriptLPS(1);
1725
1726 return World.RegionInfo.RegionSettings.LoadedCreationTime;
1727 }
1728
1729 public string osLoadedCreationID()
1730 {
1731 CheckThreatLevel(ThreatLevel.Low, "osLoadedCreationID");
1732 m_host.AddScriptLPS(1);
1733
1734 return World.RegionInfo.RegionSettings.LoadedCreationID;
1735 }
1736
1712 } 1737 }
1713} 1738}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 548e11f..e337c6b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -142,5 +142,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
142 LSL_String osFormatString(string str, LSL_List strings); 142 LSL_String osFormatString(string str, LSL_List strings);
143 LSL_List osMatchString(string src, string pattern, int start); 143 LSL_List osMatchString(string src, string pattern, int start);
144 144
145 // Information about data loaded into the region
146 string osLoadedCreationDate();
147 string osLoadedCreationTime();
148 string osLoadedCreationID();
149
145 } 150 }
146} 151}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index a0d924d..5df2d6e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -371,6 +371,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
371 return m_OSSL_Functions.osMatchString(src, pattern, start); 371 return m_OSSL_Functions.osMatchString(src, pattern, start);
372 } 372 }
373 373
374 // Information about data loaded into the region
375 public string osLoadedCreationDate()
376 {
377 return m_OSSL_Functions.osLoadedCreationDate();
378 }
379
380 public string osLoadedCreationTime()
381 {
382 return m_OSSL_Functions.osLoadedCreationTime();
383 }
384
385 public string osLoadedCreationID()
386 {
387 return m_OSSL_Functions.osLoadedCreationID();
388 }
389
390
374 public OSSLPrim Prim; 391 public OSSLPrim Prim;
375 392
376 [Serializable] 393 [Serializable]