aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs37
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs38
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs4
3 files changed, 41 insertions, 38 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs
index eb9688d..d1fe1f5 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs
@@ -108,12 +108,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
108// "[ARCHIVER]: Received {0} of {1} assets requested", 108// "[ARCHIVER]: Received {0} of {1} assets requested",
109// assetsFoundUuids.Count, assetsFoundUuids.Count + assetsNotFoundUuids.Count); 109// assetsFoundUuids.Count, assetsFoundUuids.Count + assetsNotFoundUuids.Count);
110 110
111 m_log.InfoFormat("[ARCHIVER]: Creating archive file. This may take some time.");
112
113 // Write out control file
114 m_archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p2ControlFile());
115 m_log.InfoFormat("[ARCHIVER]: Added control file to archive.");
116
117 // Write out region settings 111 // Write out region settings
118 string settingsPath 112 string settingsPath
119 = String.Format("{0}{1}.xml", ArchiveConstants.SETTINGS_PATH, m_scene.RegionInfo.RegionName); 113 = String.Format("{0}{1}.xml", ArchiveConstants.SETTINGS_PATH, m_scene.RegionInfo.RegionName);
@@ -155,35 +149,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
155 m_log.InfoFormat("[ARCHIVER]: Added scene objects to archive."); 149 m_log.InfoFormat("[ARCHIVER]: Added scene objects to archive.");
156 } 150 }
157 151
158 /// <summary> 152
159 /// Create the control file for a 0.2 version archive
160 /// </summary>
161 /// <returns></returns>
162 public static string Create0p2ControlFile()
163 {
164 StringWriter sw = new StringWriter();
165 XmlTextWriter xtw = new XmlTextWriter(sw);
166 xtw.Formatting = Formatting.Indented;
167 xtw.WriteStartDocument();
168 xtw.WriteStartElement("archive");
169 xtw.WriteAttributeString("major_version", "0");
170 xtw.WriteAttributeString("minor_version", "3");
171
172 xtw.WriteStartElement("creation_info");
173 DateTime now = DateTime.UtcNow;
174 TimeSpan t = now - new DateTime(1970, 1, 1);
175 xtw.WriteElementString("datetime", ((int)t.TotalSeconds).ToString());
176 xtw.WriteElementString("id", UUID.Random().ToString());
177 xtw.WriteEndElement();
178 xtw.WriteEndElement();
179
180 xtw.Flush();
181 xtw.Close();
182
183 String s = sw.ToString();
184 sw.Close();
185
186 return s;
187 }
188 } 153 }
189} 154}
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}
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
index 3342164..b72cd02 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
@@ -230,7 +230,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
230 // upset load 230 // upset load
231 tar.WriteDir(ArchiveConstants.TERRAINS_PATH); 231 tar.WriteDir(ArchiveConstants.TERRAINS_PATH);
232 232
233 tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestExecution.Create0p2ControlFile()); 233 tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestPreparation.Create0p2ControlFile());
234 234
235 SceneObjectPart part1 = CreateSceneObjectPart1(); 235 SceneObjectPart part1 = CreateSceneObjectPart1();
236 SceneObjectGroup object1 = new SceneObjectGroup(part1); 236 SceneObjectGroup object1 = new SceneObjectGroup(part1);
@@ -329,7 +329,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
329 TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream); 329 TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
330 330
331 tar.WriteDir(ArchiveConstants.TERRAINS_PATH); 331 tar.WriteDir(ArchiveConstants.TERRAINS_PATH);
332 tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestExecution.Create0p2ControlFile()); 332 tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestPreparation.Create0p2ControlFile());
333 333
334 RegionSettings rs = new RegionSettings(); 334 RegionSettings rs = new RegionSettings();
335 rs.AgentLimit = 17; 335 rs.AgentLimit = 17;