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.0.6.6-post-fixes
parent
074b66ddcf
commit
717fd3b5b9
|
@ -741,7 +741,8 @@ namespace OpenSim.Data.MySQL
|
||||||
"terrain_raise_limit, terrain_lower_limit, " +
|
"terrain_raise_limit, terrain_lower_limit, " +
|
||||||
"use_estate_sun, fixed_sun, sun_position, " +
|
"use_estate_sun, fixed_sun, sun_position, " +
|
||||||
"covenant, Sandbox, sunvectorx, sunvectory, " +
|
"covenant, Sandbox, sunvectorx, sunvectory, " +
|
||||||
"sunvectorz) values ( ?RegionUUID, ?BlockTerraform, " +
|
"sunvectorz, loaded_creation_date, loaded_creation_time, " +
|
||||||
|
"loaded_creation_id) values ( ?RegionUUID, ?BlockTerraform, " +
|
||||||
"?BlockFly, ?AllowDamage, ?RestrictPushing, " +
|
"?BlockFly, ?AllowDamage, ?RestrictPushing, " +
|
||||||
"?AllowLandResell, ?AllowLandJoinDivide, " +
|
"?AllowLandResell, ?AllowLandJoinDivide, " +
|
||||||
"?BlockShowInSearch, ?AgentLimit, ?ObjectBonus, " +
|
"?BlockShowInSearch, ?AgentLimit, ?ObjectBonus, " +
|
||||||
|
@ -754,12 +755,14 @@ namespace OpenSim.Data.MySQL
|
||||||
"?WaterHeight, ?TerrainRaiseLimit, " +
|
"?WaterHeight, ?TerrainRaiseLimit, " +
|
||||||
"?TerrainLowerLimit, ?UseEstateSun, ?FixedSun, " +
|
"?TerrainLowerLimit, ?UseEstateSun, ?FixedSun, " +
|
||||||
"?SunPosition, ?Covenant, ?Sandbox, " +
|
"?SunPosition, ?Covenant, ?Sandbox, " +
|
||||||
"?SunVectorX, ?SunVectorY, ?SunVectorZ)";
|
"?SunVectorX, ?SunVectorY, ?SunVectorZ, " +
|
||||||
|
"?LoadedCreationDate, ?LoadedCreationTime, ?LoadedCreationID)";
|
||||||
|
|
||||||
FillRegionSettingsCommand(cmd, rs);
|
FillRegionSettingsCommand(cmd, rs);
|
||||||
|
|
||||||
ExecuteNonQuery(cmd);
|
ExecuteNonQuery(cmd);
|
||||||
cmd.Dispose();
|
cmd.Dispose();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1039,6 +1042,21 @@ namespace OpenSim.Data.MySQL
|
||||||
newSettings.SunPosition = Convert.ToDouble(row["sun_position"]);
|
newSettings.SunPosition = Convert.ToDouble(row["sun_position"]);
|
||||||
newSettings.Covenant = new UUID((String) row["covenant"]);
|
newSettings.Covenant = new UUID((String) row["covenant"]);
|
||||||
|
|
||||||
|
if (row["loaded_creation_date"] is DBNull)
|
||||||
|
newSettings.LoadedCreationDate = "";
|
||||||
|
else
|
||||||
|
newSettings.LoadedCreationDate = (String) row["loaded_creation_date"];
|
||||||
|
|
||||||
|
if (row["loaded_creation_time"] is DBNull)
|
||||||
|
newSettings.LoadedCreationTime = "";
|
||||||
|
else
|
||||||
|
newSettings.LoadedCreationTime = (String) row["loaded_creation_time"];
|
||||||
|
|
||||||
|
if (row["loaded_creation_id"] is DBNull)
|
||||||
|
newSettings.LoadedCreationID = "";
|
||||||
|
else
|
||||||
|
newSettings.LoadedCreationID = (String) row["loaded_creation_id"];
|
||||||
|
|
||||||
return newSettings;
|
return newSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1357,6 +1375,10 @@ namespace OpenSim.Data.MySQL
|
||||||
cmd.Parameters.AddWithValue("FixedSun", settings.FixedSun);
|
cmd.Parameters.AddWithValue("FixedSun", settings.FixedSun);
|
||||||
cmd.Parameters.AddWithValue("SunPosition", settings.SunPosition);
|
cmd.Parameters.AddWithValue("SunPosition", settings.SunPosition);
|
||||||
cmd.Parameters.AddWithValue("Covenant", settings.Covenant.ToString());
|
cmd.Parameters.AddWithValue("Covenant", settings.Covenant.ToString());
|
||||||
|
cmd.Parameters.AddWithValue("LoadedCreationDate", settings.LoadedCreationDate);
|
||||||
|
cmd.Parameters.AddWithValue("LoadedCreationTime", settings.LoadedCreationTime);
|
||||||
|
cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
BEGIN;
|
||||||
|
|
||||||
|
ALTER TABLE regionsettings ADD COLUMN loaded_creation_date varchar(20) default NULL;
|
||||||
|
ALTER TABLE regionsettings ADD COLUMN loaded_creation_time varchar(20) default NULL;
|
||||||
|
ALTER TABLE regionsettings ADD COLUMN loaded_creation_id varchar(64) default NULL;
|
||||||
|
|
||||||
|
COMMIT;
|
|
@ -560,5 +560,29 @@ namespace OpenSim.Framework
|
||||||
get { return m_Covenant; }
|
get { return m_Covenant; }
|
||||||
set { m_Covenant = value; }
|
set { m_Covenant = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String m_LoadedCreationDate;
|
||||||
|
|
||||||
|
public String LoadedCreationDate
|
||||||
|
{
|
||||||
|
get { return m_LoadedCreationDate; }
|
||||||
|
set { m_LoadedCreationDate = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private String m_LoadedCreationTime;
|
||||||
|
|
||||||
|
public String LoadedCreationTime
|
||||||
|
{
|
||||||
|
get { return m_LoadedCreationTime; }
|
||||||
|
set { m_LoadedCreationTime = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private String m_LoadedCreationID;
|
||||||
|
public String LoadedCreationID
|
||||||
|
{
|
||||||
|
get { return m_LoadedCreationID; }
|
||||||
|
set { m_LoadedCreationID = value; }
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ using System.IO.Compression;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Xml;
|
||||||
using log4net;
|
using log4net;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
|
@ -134,6 +135,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
else if (!m_merge && filePath.StartsWith(ArchiveConstants.SETTINGS_PATH))
|
else if (!m_merge && filePath.StartsWith(ArchiveConstants.SETTINGS_PATH))
|
||||||
{
|
{
|
||||||
LoadRegionSettings(filePath, data);
|
LoadRegionSettings(filePath, data);
|
||||||
|
} else if (filePath == ArchiveConstants.CONTROL_FILE_PATH) {
|
||||||
|
LoadArchiveMetadata(filePath, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -478,5 +481,60 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
// return new BufferedStream(file, (int) response.ContentLength);
|
// return new BufferedStream(file, (int) response.ContentLength);
|
||||||
return new BufferedStream(file, 1000000);
|
return new BufferedStream(file, 1000000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Load oar file metadata
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="terrainPath"></param>
|
||||||
|
/// <param name="data"></param>
|
||||||
|
/// <returns>
|
||||||
|
/// true if terrain was resolved successfully, false otherwise.
|
||||||
|
/// </returns>
|
||||||
|
private bool LoadArchiveMetadata(string terrainPath, byte[] data)
|
||||||
|
{
|
||||||
|
//Create the XmlNamespaceManager.
|
||||||
|
NameTable nt = new NameTable();
|
||||||
|
XmlNamespaceManager nsmgr = new XmlNamespaceManager(nt);
|
||||||
|
|
||||||
|
// Create the XmlParserContext.
|
||||||
|
XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None);
|
||||||
|
|
||||||
|
XmlTextReader xtr = new XmlTextReader(m_asciiEncoding.GetString(data),
|
||||||
|
XmlNodeType.Document, context);
|
||||||
|
|
||||||
|
|
||||||
|
RegionSettings currentRegionSettings = m_scene.RegionInfo.RegionSettings;
|
||||||
|
|
||||||
|
// Loaded metadata will empty if no information exists in the archive
|
||||||
|
currentRegionSettings.LoadedCreationDate = "";
|
||||||
|
currentRegionSettings.LoadedCreationTime = "";
|
||||||
|
currentRegionSettings.LoadedCreationID = "";
|
||||||
|
|
||||||
|
while (xtr.Read())
|
||||||
|
{
|
||||||
|
if (xtr.NodeType == XmlNodeType.Element)
|
||||||
|
{
|
||||||
|
if (xtr.Name.ToString()=="date")
|
||||||
|
{
|
||||||
|
currentRegionSettings.LoadedCreationDate = xtr.ReadElementContentAsString();
|
||||||
|
}
|
||||||
|
else if (xtr.Name.ToString()=="time")
|
||||||
|
{
|
||||||
|
currentRegionSettings.LoadedCreationTime = xtr.ReadElementContentAsString();
|
||||||
|
}
|
||||||
|
else if (xtr.Name.ToString()=="id")
|
||||||
|
{
|
||||||
|
currentRegionSettings.LoadedCreationID = xtr.ReadElementContentAsString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
currentRegionSettings.Save();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,7 +154,15 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
xtw.WriteStartElement("archive");
|
xtw.WriteStartElement("archive");
|
||||||
xtw.WriteAttributeString("major_version", "0");
|
xtw.WriteAttributeString("major_version", "0");
|
||||||
xtw.WriteAttributeString("minor_version", "2");
|
xtw.WriteAttributeString("minor_version", "2");
|
||||||
|
|
||||||
|
xtw.WriteStartElement("creation_info");
|
||||||
|
DateTime now = DateTime.UtcNow;
|
||||||
|
xtw.WriteElementString("date", now.ToLongDateString());
|
||||||
|
xtw.WriteElementString("time", now.ToLongTimeString());
|
||||||
|
xtw.WriteElementString("id", UUID.Random().ToString());
|
||||||
xtw.WriteEndElement();
|
xtw.WriteEndElement();
|
||||||
|
xtw.WriteEndElement();
|
||||||
|
|
||||||
|
|
||||||
xtw.Flush();
|
xtw.Flush();
|
||||||
xtw.Close();
|
xtw.Close();
|
||||||
|
|
|
@ -1709,5 +1709,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string osLoadedCreationDate()
|
||||||
|
{
|
||||||
|
CheckThreatLevel(ThreatLevel.Low, "osLoadedCreationDate");
|
||||||
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
|
return World.RegionInfo.RegionSettings.LoadedCreationDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string osLoadedCreationTime()
|
||||||
|
{
|
||||||
|
CheckThreatLevel(ThreatLevel.Low, "osLoadedCreationTime");
|
||||||
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
|
return World.RegionInfo.RegionSettings.LoadedCreationTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string osLoadedCreationID()
|
||||||
|
{
|
||||||
|
CheckThreatLevel(ThreatLevel.Low, "osLoadedCreationID");
|
||||||
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
|
return World.RegionInfo.RegionSettings.LoadedCreationID;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,5 +142,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
||||||
LSL_String osFormatString(string str, LSL_List strings);
|
LSL_String osFormatString(string str, LSL_List strings);
|
||||||
LSL_List osMatchString(string src, string pattern, int start);
|
LSL_List osMatchString(string src, string pattern, int start);
|
||||||
|
|
||||||
|
// Information about data loaded into the region
|
||||||
|
string osLoadedCreationDate();
|
||||||
|
string osLoadedCreationTime();
|
||||||
|
string osLoadedCreationID();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -371,6 +371,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||||
return m_OSSL_Functions.osMatchString(src, pattern, start);
|
return m_OSSL_Functions.osMatchString(src, pattern, start);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Information about data loaded into the region
|
||||||
|
public string osLoadedCreationDate()
|
||||||
|
{
|
||||||
|
return m_OSSL_Functions.osLoadedCreationDate();
|
||||||
|
}
|
||||||
|
|
||||||
|
public string osLoadedCreationTime()
|
||||||
|
{
|
||||||
|
return m_OSSL_Functions.osLoadedCreationTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
public string osLoadedCreationID()
|
||||||
|
{
|
||||||
|
return m_OSSL_Functions.osLoadedCreationID();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public OSSLPrim Prim;
|
public OSSLPrim Prim;
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
|
|
Loading…
Reference in New Issue