aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs')
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs46
1 files changed, 27 insertions, 19 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index b1b2336f8..c52f029 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
@@ -53,25 +53,27 @@ namespace OpenSim.Region.CoreModules.World.Archiver
53 { 53 {
54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
55 55
56 private static ASCIIEncoding m_asciiEncoding = new ASCIIEncoding(); 56 protected Scene m_scene;
57 private static UTF8Encoding m_utf8Encoding = new UTF8Encoding(); 57 protected Stream m_loadStream;
58 58 protected Guid m_requestId;
59 private Scene m_scene; 59 protected string m_errorMessage;
60 private Stream m_loadStream;
61 private Guid m_requestId;
62 private string m_errorMessage;
63 60
64 /// <value> 61 /// <value>
65 /// Should the archive being loaded be merged with what is already on the region? 62 /// Should the archive being loaded be merged with what is already on the region?
66 /// </value> 63 /// </value>
67 private bool m_merge; 64 protected bool m_merge;
65
66 /// <value>
67 /// Should we ignore any assets when reloading the archive?
68 /// </value>
69 protected bool m_skipAssets;
68 70
69 /// <summary> 71 /// <summary>
70 /// Used to cache lookups for valid uuids. 72 /// Used to cache lookups for valid uuids.
71 /// </summary> 73 /// </summary>
72 private IDictionary<UUID, bool> m_validUserUuids = new Dictionary<UUID, bool>(); 74 private IDictionary<UUID, bool> m_validUserUuids = new Dictionary<UUID, bool>();
73 75
74 public ArchiveReadRequest(Scene scene, string loadPath, bool merge, Guid requestId) 76 public ArchiveReadRequest(Scene scene, string loadPath, bool merge, bool skipAssets, Guid requestId)
75 { 77 {
76 m_scene = scene; 78 m_scene = scene;
77 79
@@ -89,14 +91,16 @@ namespace OpenSim.Region.CoreModules.World.Archiver
89 91
90 m_errorMessage = String.Empty; 92 m_errorMessage = String.Empty;
91 m_merge = merge; 93 m_merge = merge;
94 m_skipAssets = skipAssets;
92 m_requestId = requestId; 95 m_requestId = requestId;
93 } 96 }
94 97
95 public ArchiveReadRequest(Scene scene, Stream loadStream, bool merge, Guid requestId) 98 public ArchiveReadRequest(Scene scene, Stream loadStream, bool merge, bool skipAssets, Guid requestId)
96 { 99 {
97 m_scene = scene; 100 m_scene = scene;
98 m_loadStream = loadStream; 101 m_loadStream = loadStream;
99 m_merge = merge; 102 m_merge = merge;
103 m_skipAssets = skipAssets;
100 m_requestId = requestId; 104 m_requestId = requestId;
101 } 105 }
102 106
@@ -133,9 +137,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver
133 137
134 if (filePath.StartsWith(ArchiveConstants.OBJECTS_PATH)) 138 if (filePath.StartsWith(ArchiveConstants.OBJECTS_PATH))
135 { 139 {
136 serialisedSceneObjects.Add(m_utf8Encoding.GetString(data)); 140 serialisedSceneObjects.Add(Encoding.UTF8.GetString(data));
137 } 141 }
138 else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) 142 else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH) && !m_skipAssets)
139 { 143 {
140 if (LoadAsset(filePath, data)) 144 if (LoadAsset(filePath, data))
141 successfulAssetRestores++; 145 successfulAssetRestores++;
@@ -155,7 +159,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
155 } 159 }
156 else if (!m_merge && filePath.StartsWith(ArchiveConstants.LANDDATA_PATH)) 160 else if (!m_merge && filePath.StartsWith(ArchiveConstants.LANDDATA_PATH))
157 { 161 {
158 serialisedParcels.Add(m_utf8Encoding.GetString(data)); 162 serialisedParcels.Add(Encoding.UTF8.GetString(data));
159 } 163 }
160 else if (filePath == ArchiveConstants.CONTROL_FILE_PATH) 164 else if (filePath == ArchiveConstants.CONTROL_FILE_PATH)
161 { 165 {
@@ -178,12 +182,15 @@ namespace OpenSim.Region.CoreModules.World.Archiver
178 archive.Close(); 182 archive.Close();
179 } 183 }
180 184
181 m_log.InfoFormat("[ARCHIVER]: Restored {0} assets", successfulAssetRestores); 185 if (!m_skipAssets)
182
183 if (failedAssetRestores > 0)
184 { 186 {
185 m_log.ErrorFormat("[ARCHIVER]: Failed to load {0} assets", failedAssetRestores); 187 m_log.InfoFormat("[ARCHIVER]: Restored {0} assets", successfulAssetRestores);
186 m_errorMessage += String.Format("Failed to load {0} assets", failedAssetRestores); 188
189 if (failedAssetRestores > 0)
190 {
191 m_log.ErrorFormat("[ARCHIVER]: Failed to load {0} assets", failedAssetRestores);
192 m_errorMessage += String.Format("Failed to load {0} assets", failedAssetRestores);
193 }
187 } 194 }
188 195
189 if (!m_merge) 196 if (!m_merge)
@@ -277,6 +284,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
277 { 284 {
278 sceneObjectsLoadedCount++; 285 sceneObjectsLoadedCount++;
279 sceneObject.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, 0); 286 sceneObject.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, 0);
287 sceneObject.ResumeScripts();
280 } 288 }
281 } 289 }
282 290
@@ -541,7 +549,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
541 XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None); 549 XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None);
542 550
543 XmlTextReader xtr 551 XmlTextReader xtr
544 = new XmlTextReader(m_asciiEncoding.GetString(data), XmlNodeType.Document, context); 552 = new XmlTextReader(Encoding.ASCII.GetString(data), XmlNodeType.Document, context);
545 553
546 RegionSettings currentRegionSettings = m_scene.RegionInfo.RegionSettings; 554 RegionSettings currentRegionSettings = m_scene.RegionInfo.RegionSettings;
547 555