aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-10-16 03:52:11 +0100
committerJustin Clark-Casey (justincc)2010-10-16 03:52:11 +0100
commit1bd4219078b48e0e69aca65908a127bc19ca5610 (patch)
treed9ff5f44a4baf6b1825d95520e87b7393b0d1847 /OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
parentFix test break - TestSerializeXml2() still requires old-guids option (diff)
downloadopensim-SC_OLD-1bd4219078b48e0e69aca65908a127bc19ca5610.zip
opensim-SC_OLD-1bd4219078b48e0e69aca65908a127bc19ca5610.tar.gz
opensim-SC_OLD-1bd4219078b48e0e69aca65908a127bc19ca5610.tar.bz2
opensim-SC_OLD-1bd4219078b48e0e69aca65908a127bc19ca5610.tar.xz
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 now
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs38
1 files changed, 38 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
index e9a476c..f867e50 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
@@ -32,6 +32,7 @@ using System.IO.Compression;
32using System.Reflection; 32using System.Reflection;
33using System.Text.RegularExpressions; 33using System.Text.RegularExpressions;
34using System.Threading; 34using System.Threading;
35using System.Xml;
35using log4net; 36using log4net;
36using OpenMetaverse; 37using OpenMetaverse;
37using OpenSim.Framework; 38using OpenSim.Framework;
@@ -167,10 +168,47 @@ namespace OpenSim.Region.CoreModules.World.Archiver
167 archiveWriter, 168 archiveWriter,
168 m_requestId, 169 m_requestId,
169 options); 170 options);
171
172 m_log.InfoFormat("[ARCHIVER]: Creating archive file. This may take some time.");
173
174 // Write out control file
175 archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p2ControlFile());
176 m_log.InfoFormat("[ARCHIVER]: Added control file to archive.");
170 177
171 new AssetsRequest( 178 new AssetsRequest(
172 new AssetsArchiver(archiveWriter), assetUuids, 179 new AssetsArchiver(archiveWriter), assetUuids,
173 m_scene.AssetService, awre.ReceivedAllAssets).Execute(); 180 m_scene.AssetService, awre.ReceivedAllAssets).Execute();
174 } 181 }
182
183 /// <summary>
184 /// Create the control file for a 0.2 version archive
185 /// </summary>
186 /// <returns></returns>
187 public static string Create0p2ControlFile()
188 {
189 StringWriter sw = new StringWriter();
190 XmlTextWriter xtw = new XmlTextWriter(sw);
191 xtw.Formatting = Formatting.Indented;
192 xtw.WriteStartDocument();
193 xtw.WriteStartElement("archive");
194 xtw.WriteAttributeString("major_version", "0");
195 xtw.WriteAttributeString("minor_version", "3");
196
197 xtw.WriteStartElement("creation_info");
198 DateTime now = DateTime.UtcNow;
199 TimeSpan t = now - new DateTime(1970, 1, 1);
200 xtw.WriteElementString("datetime", ((int)t.TotalSeconds).ToString());
201 xtw.WriteElementString("id", UUID.Random().ToString());
202 xtw.WriteEndElement();
203 xtw.WriteEndElement();
204
205 xtw.Flush();
206 xtw.Close();
207
208 String s = sw.ToString();
209 sw.Close();
210
211 return s;
212 }
175 } 213 }
176} 214}