save oar control file first rather than in the middle so that it's the first thing we come accross on load
this exposes a weekness with using tar where we don't control the order in which files are loaded. can't be helped for nowviewer-2-initial-appearance
parent
fe4e6ff811
commit
1bd4219078
|
@ -108,12 +108,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
// "[ARCHIVER]: Received {0} of {1} assets requested",
|
// "[ARCHIVER]: Received {0} of {1} assets requested",
|
||||||
// assetsFoundUuids.Count, assetsFoundUuids.Count + assetsNotFoundUuids.Count);
|
// assetsFoundUuids.Count, assetsFoundUuids.Count + assetsNotFoundUuids.Count);
|
||||||
|
|
||||||
m_log.InfoFormat("[ARCHIVER]: Creating archive file. This may take some time.");
|
|
||||||
|
|
||||||
// Write out control file
|
|
||||||
m_archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p2ControlFile());
|
|
||||||
m_log.InfoFormat("[ARCHIVER]: Added control file to archive.");
|
|
||||||
|
|
||||||
// Write out region settings
|
// Write out region settings
|
||||||
string settingsPath
|
string settingsPath
|
||||||
= String.Format("{0}{1}.xml", ArchiveConstants.SETTINGS_PATH, m_scene.RegionInfo.RegionName);
|
= String.Format("{0}{1}.xml", ArchiveConstants.SETTINGS_PATH, m_scene.RegionInfo.RegionName);
|
||||||
|
@ -155,35 +149,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
m_log.InfoFormat("[ARCHIVER]: Added scene objects to archive.");
|
m_log.InfoFormat("[ARCHIVER]: Added scene objects to archive.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Create the control file for a 0.2 version archive
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static string Create0p2ControlFile()
|
|
||||||
{
|
|
||||||
StringWriter sw = new StringWriter();
|
|
||||||
XmlTextWriter xtw = new XmlTextWriter(sw);
|
|
||||||
xtw.Formatting = Formatting.Indented;
|
|
||||||
xtw.WriteStartDocument();
|
|
||||||
xtw.WriteStartElement("archive");
|
|
||||||
xtw.WriteAttributeString("major_version", "0");
|
|
||||||
xtw.WriteAttributeString("minor_version", "3");
|
|
||||||
|
|
||||||
xtw.WriteStartElement("creation_info");
|
|
||||||
DateTime now = DateTime.UtcNow;
|
|
||||||
TimeSpan t = now - new DateTime(1970, 1, 1);
|
|
||||||
xtw.WriteElementString("datetime", ((int)t.TotalSeconds).ToString());
|
|
||||||
xtw.WriteElementString("id", UUID.Random().ToString());
|
|
||||||
xtw.WriteEndElement();
|
|
||||||
xtw.WriteEndElement();
|
|
||||||
|
|
||||||
xtw.Flush();
|
|
||||||
xtw.Close();
|
|
||||||
|
|
||||||
String s = sw.ToString();
|
|
||||||
sw.Close();
|
|
||||||
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ using System.IO.Compression;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using System.Xml;
|
||||||
using log4net;
|
using log4net;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
|
@ -167,10 +168,47 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
archiveWriter,
|
archiveWriter,
|
||||||
m_requestId,
|
m_requestId,
|
||||||
options);
|
options);
|
||||||
|
|
||||||
|
m_log.InfoFormat("[ARCHIVER]: Creating archive file. This may take some time.");
|
||||||
|
|
||||||
|
// Write out control file
|
||||||
|
archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p2ControlFile());
|
||||||
|
m_log.InfoFormat("[ARCHIVER]: Added control file to archive.");
|
||||||
|
|
||||||
new AssetsRequest(
|
new AssetsRequest(
|
||||||
new AssetsArchiver(archiveWriter), assetUuids,
|
new AssetsArchiver(archiveWriter), assetUuids,
|
||||||
m_scene.AssetService, awre.ReceivedAllAssets).Execute();
|
m_scene.AssetService, awre.ReceivedAllAssets).Execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create the control file for a 0.2 version archive
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string Create0p2ControlFile()
|
||||||
|
{
|
||||||
|
StringWriter sw = new StringWriter();
|
||||||
|
XmlTextWriter xtw = new XmlTextWriter(sw);
|
||||||
|
xtw.Formatting = Formatting.Indented;
|
||||||
|
xtw.WriteStartDocument();
|
||||||
|
xtw.WriteStartElement("archive");
|
||||||
|
xtw.WriteAttributeString("major_version", "0");
|
||||||
|
xtw.WriteAttributeString("minor_version", "3");
|
||||||
|
|
||||||
|
xtw.WriteStartElement("creation_info");
|
||||||
|
DateTime now = DateTime.UtcNow;
|
||||||
|
TimeSpan t = now - new DateTime(1970, 1, 1);
|
||||||
|
xtw.WriteElementString("datetime", ((int)t.TotalSeconds).ToString());
|
||||||
|
xtw.WriteElementString("id", UUID.Random().ToString());
|
||||||
|
xtw.WriteEndElement();
|
||||||
|
xtw.WriteEndElement();
|
||||||
|
|
||||||
|
xtw.Flush();
|
||||||
|
xtw.Close();
|
||||||
|
|
||||||
|
String s = sw.ToString();
|
||||||
|
sw.Close();
|
||||||
|
|
||||||
|
return s;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -230,7 +230,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
||||||
// upset load
|
// upset load
|
||||||
tar.WriteDir(ArchiveConstants.TERRAINS_PATH);
|
tar.WriteDir(ArchiveConstants.TERRAINS_PATH);
|
||||||
|
|
||||||
tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestExecution.Create0p2ControlFile());
|
tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestPreparation.Create0p2ControlFile());
|
||||||
|
|
||||||
SceneObjectPart part1 = CreateSceneObjectPart1();
|
SceneObjectPart part1 = CreateSceneObjectPart1();
|
||||||
SceneObjectGroup object1 = new SceneObjectGroup(part1);
|
SceneObjectGroup object1 = new SceneObjectGroup(part1);
|
||||||
|
@ -329,7 +329,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
|
||||||
TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
|
TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
|
||||||
|
|
||||||
tar.WriteDir(ArchiveConstants.TERRAINS_PATH);
|
tar.WriteDir(ArchiveConstants.TERRAINS_PATH);
|
||||||
tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestExecution.Create0p2ControlFile());
|
tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestPreparation.Create0p2ControlFile());
|
||||||
|
|
||||||
RegionSettings rs = new RegionSettings();
|
RegionSettings rs = new RegionSettings();
|
||||||
rs.AgentLimit = 17;
|
rs.AgentLimit = 17;
|
||||||
|
|
Loading…
Reference in New Issue