diff options
Merge branch 'master' into careminster
Diffstat (limited to 'OpenSim/Region')
12 files changed, 161 insertions, 107 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 60c34df..f9be1e2 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs | |||
@@ -1294,14 +1294,7 @@ namespace OpenSim | |||
1294 | { | 1294 | { |
1295 | try | 1295 | try |
1296 | { | 1296 | { |
1297 | if (cmdparams.Length > 2) | 1297 | m_sceneManager.LoadArchiveToCurrentScene(cmdparams); |
1298 | { | ||
1299 | m_sceneManager.LoadArchiveToCurrentScene(cmdparams[2]); | ||
1300 | } | ||
1301 | else | ||
1302 | { | ||
1303 | m_sceneManager.LoadArchiveToCurrentScene(DEFAULT_OAR_BACKUP_FILENAME); | ||
1304 | } | ||
1305 | } | 1298 | } |
1306 | catch (Exception e) | 1299 | catch (Exception e) |
1307 | { | 1300 | { |
@@ -1315,14 +1308,7 @@ namespace OpenSim | |||
1315 | /// <param name="cmdparams"></param> | 1308 | /// <param name="cmdparams"></param> |
1316 | protected void SaveOar(string module, string[] cmdparams) | 1309 | protected void SaveOar(string module, string[] cmdparams) |
1317 | { | 1310 | { |
1318 | if (cmdparams.Length > 2) | 1311 | m_sceneManager.SaveCurrentSceneToArchive(cmdparams); |
1319 | { | ||
1320 | m_sceneManager.SaveCurrentSceneToArchive(cmdparams[2]); | ||
1321 | } | ||
1322 | else | ||
1323 | { | ||
1324 | m_sceneManager.SaveCurrentSceneToArchive(DEFAULT_OAR_BACKUP_FILENAME); | ||
1325 | } | ||
1326 | } | 1312 | } |
1327 | 1313 | ||
1328 | private static string CombineParams(string[] commandParams, int pos) | 1314 | private static string CombineParams(string[] commandParams, int pos) |
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index cc18f1a..391856b 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs | |||
@@ -75,11 +75,6 @@ namespace OpenSim | |||
75 | /// </value> | 75 | /// </value> |
76 | protected const string DEFAULT_PRIM_BACKUP_FILENAME = "prim-backup.xml"; | 76 | protected const string DEFAULT_PRIM_BACKUP_FILENAME = "prim-backup.xml"; |
77 | 77 | ||
78 | /// <value> | ||
79 | /// The file used to load and save an opensimulator archive if no filename has been specified | ||
80 | /// </value> | ||
81 | protected const string DEFAULT_OAR_BACKUP_FILENAME = "region.oar"; | ||
82 | |||
83 | public ConfigSettings ConfigurationSettings | 78 | public ConfigSettings ConfigurationSettings |
84 | { | 79 | { |
85 | get { return m_configSettings; } | 80 | get { return m_configSettings; } |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index a8206dc..ac16b02 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -8113,8 +8113,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
8113 | //lsrp.RequestData.RequestFlags; | 8113 | //lsrp.RequestData.RequestFlags; |
8114 | //lsrp.RequestData.Filter; | 8114 | //lsrp.RequestData.Filter; |
8115 | 8115 | ||
8116 | return true; | 8116 | // return true; |
8117 | } | 8117 | } |
8118 | |||
8118 | private bool HandleRequestRegionInfo(IClientAPI sender, Packet Pack) | 8119 | private bool HandleRequestRegionInfo(IClientAPI sender, Packet Pack) |
8119 | { | 8120 | { |
8120 | RequestRegionInfoPacket.AgentDataBlock mPacket = ((RequestRegionInfoPacket)Pack).AgentData; | 8121 | RequestRegionInfoPacket.AgentDataBlock mPacket = ((RequestRegionInfoPacket)Pack).AgentData; |
@@ -8135,6 +8136,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
8135 | } | 8136 | } |
8136 | return true; | 8137 | return true; |
8137 | } | 8138 | } |
8139 | |||
8138 | private bool HandleEstateCovenantRequest(IClientAPI sender, Packet Pack) | 8140 | private bool HandleEstateCovenantRequest(IClientAPI sender, Packet Pack) |
8139 | { | 8141 | { |
8140 | 8142 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 9e76d79..8532d03 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | |||
@@ -121,45 +121,51 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
121 | 121 | ||
122 | byte[] data; | 122 | byte[] data; |
123 | TarArchiveReader.TarEntryType entryType; | 123 | TarArchiveReader.TarEntryType entryType; |
124 | while ((data = archive.ReadEntry(out filePath, out entryType)) != null) | ||
125 | { | ||
126 | if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) | ||
127 | { | ||
128 | if (LoadAsset(filePath, data)) | ||
129 | successfulAssetRestores++; | ||
130 | else | ||
131 | failedAssetRestores++; | ||
132 | 124 | ||
133 | if ((successfulAssetRestores) % 50 == 0) | 125 | try |
134 | m_log.DebugFormat( | 126 | { |
135 | "[INVENTORY ARCHIVER]: Loaded {0} assets...", | 127 | while ((data = archive.ReadEntry(out filePath, out entryType)) != null) |
136 | successfulAssetRestores); | ||
137 | } | ||
138 | else if (filePath.StartsWith(ArchiveConstants.INVENTORY_PATH)) | ||
139 | { | 128 | { |
140 | InventoryFolderBase foundFolder | 129 | if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) |
141 | = ReplicateArchivePathToUserInventory( | ||
142 | filePath, TarArchiveReader.TarEntryType.TYPE_DIRECTORY == entryType, | ||
143 | rootDestinationFolder, foldersCreated, nodesLoaded); | ||
144 | |||
145 | if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY != entryType) | ||
146 | { | 130 | { |
147 | InventoryItemBase item = LoadItem(data, foundFolder); | 131 | if (LoadAsset(filePath, data)) |
148 | 132 | successfulAssetRestores++; | |
149 | if (item != null) | 133 | else |
134 | failedAssetRestores++; | ||
135 | |||
136 | if ((successfulAssetRestores) % 50 == 0) | ||
137 | m_log.DebugFormat( | ||
138 | "[INVENTORY ARCHIVER]: Loaded {0} assets...", | ||
139 | successfulAssetRestores); | ||
140 | } | ||
141 | else if (filePath.StartsWith(ArchiveConstants.INVENTORY_PATH)) | ||
142 | { | ||
143 | InventoryFolderBase foundFolder | ||
144 | = ReplicateArchivePathToUserInventory( | ||
145 | filePath, TarArchiveReader.TarEntryType.TYPE_DIRECTORY == entryType, | ||
146 | rootDestinationFolder, foldersCreated, nodesLoaded); | ||
147 | |||
148 | if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY != entryType) | ||
150 | { | 149 | { |
151 | successfulItemRestores++; | 150 | InventoryItemBase item = LoadItem(data, foundFolder); |
152 | 151 | ||
153 | // If we're loading an item directly into the given destination folder then we need to record | 152 | if (item != null) |
154 | // it separately from any loaded root folders | 153 | { |
155 | if (rootDestinationFolder == foundFolder) | 154 | successfulItemRestores++; |
156 | nodesLoaded.Add(item); | 155 | |
156 | // If we're loading an item directly into the given destination folder then we need to record | ||
157 | // it separately from any loaded root folders | ||
158 | if (rootDestinationFolder == foundFolder) | ||
159 | nodesLoaded.Add(item); | ||
160 | } | ||
157 | } | 161 | } |
158 | } | 162 | } |
159 | } | 163 | } |
160 | } | 164 | } |
161 | 165 | finally | |
162 | archive.Close(); | 166 | { |
167 | archive.Close(); | ||
168 | } | ||
163 | 169 | ||
164 | m_log.DebugFormat( | 170 | m_log.DebugFormat( |
165 | "[INVENTORY ARCHIVER]: Successfully loaded {0} assets with {1} failures", | 171 | "[INVENTORY ARCHIVER]: Successfully loaded {0} assets with {1} failures", |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs index 6e11f36..c85d974 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs | |||
@@ -117,19 +117,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
117 | } | 117 | } |
118 | 118 | ||
119 | protected void ReceivedAllAssets(ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids) | 119 | protected void ReceivedAllAssets(ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids) |
120 | { | 120 | { |
121 | // We're almost done. Just need to write out the control file now | ||
122 | m_archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p1ControlFile()); | ||
123 | m_log.InfoFormat("[ARCHIVER]: Added control file to archive."); | ||
124 | |||
125 | Exception reportedException = null; | 121 | Exception reportedException = null; |
126 | bool succeeded = true; | 122 | bool succeeded = true; |
127 | 123 | ||
128 | try | 124 | try |
129 | { | 125 | { |
126 | // We're almost done. Just need to write out the control file now | ||
127 | m_archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p1ControlFile()); | ||
128 | m_log.InfoFormat("[ARCHIVER]: Added control file to archive."); | ||
129 | |||
130 | m_archiveWriter.Close(); | 130 | m_archiveWriter.Close(); |
131 | } | 131 | } |
132 | catch (IOException e) | 132 | catch (Exception e) |
133 | { | 133 | { |
134 | m_saveStream.Close(); | 134 | m_saveStream.Close(); |
135 | reportedException = e; | 135 | reportedException = e; |
@@ -261,39 +261,47 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
261 | //inventoryItem = m_userInfo.RootFolder.FindItemByPath(m_invPath); | 261 | //inventoryItem = m_userInfo.RootFolder.FindItemByPath(m_invPath); |
262 | } | 262 | } |
263 | 263 | ||
264 | m_archiveWriter = new TarArchiveWriter(m_saveStream); | 264 | if (null == inventoryFolder && null == inventoryItem) |
265 | |||
266 | if (inventoryFolder != null) | ||
267 | { | ||
268 | m_log.DebugFormat( | ||
269 | "[INVENTORY ARCHIVER]: Found folder {0} {1} at {2}", | ||
270 | inventoryFolder.Name, inventoryFolder.ID, m_invPath); | ||
271 | |||
272 | //recurse through all dirs getting dirs and files | ||
273 | SaveInvFolder(inventoryFolder, ArchiveConstants.INVENTORY_PATH, !foundStar); | ||
274 | } | ||
275 | else if (inventoryItem != null) | ||
276 | { | ||
277 | m_log.DebugFormat( | ||
278 | "[INVENTORY ARCHIVER]: Found item {0} {1} at {2}", | ||
279 | inventoryItem.Name, inventoryItem.ID, m_invPath); | ||
280 | |||
281 | SaveInvItem(inventoryItem, ArchiveConstants.INVENTORY_PATH); | ||
282 | } | ||
283 | else | ||
284 | { | 265 | { |
285 | // We couldn't find the path indicated | 266 | // We couldn't find the path indicated |
286 | m_saveStream.Close(); | ||
287 | string errorMessage = string.Format("Aborted save. Could not find inventory path {0}", m_invPath); | 267 | string errorMessage = string.Format("Aborted save. Could not find inventory path {0}", m_invPath); |
288 | m_log.ErrorFormat("[INVENTORY ARCHIVER]: {0}", errorMessage); | 268 | m_log.ErrorFormat("[INVENTORY ARCHIVER]: {0}", errorMessage); |
289 | m_module.TriggerInventoryArchiveSaved( | 269 | m_module.TriggerInventoryArchiveSaved( |
290 | m_id, false, m_userInfo, m_invPath, m_saveStream, | 270 | m_id, false, m_userInfo, m_invPath, m_saveStream, |
291 | new Exception(errorMessage)); | 271 | new Exception(errorMessage)); |
292 | return; | 272 | return; |
293 | } | 273 | } |
274 | |||
275 | m_archiveWriter = new TarArchiveWriter(m_saveStream); | ||
294 | 276 | ||
295 | // Don't put all this profile information into the archive right now. | 277 | try |
296 | //SaveUsers(); | 278 | { |
279 | if (inventoryFolder != null) | ||
280 | { | ||
281 | m_log.DebugFormat( | ||
282 | "[INVENTORY ARCHIVER]: Found folder {0} {1} at {2}", | ||
283 | inventoryFolder.Name, inventoryFolder.ID, m_invPath); | ||
284 | |||
285 | //recurse through all dirs getting dirs and files | ||
286 | SaveInvFolder(inventoryFolder, ArchiveConstants.INVENTORY_PATH, !foundStar); | ||
287 | } | ||
288 | else if (inventoryItem != null) | ||
289 | { | ||
290 | m_log.DebugFormat( | ||
291 | "[INVENTORY ARCHIVER]: Found item {0} {1} at {2}", | ||
292 | inventoryItem.Name, inventoryItem.ID, m_invPath); | ||
293 | |||
294 | SaveInvItem(inventoryItem, ArchiveConstants.INVENTORY_PATH); | ||
295 | } | ||
296 | |||
297 | // Don't put all this profile information into the archive right now. | ||
298 | //SaveUsers(); | ||
299 | } | ||
300 | catch (Exception) | ||
301 | { | ||
302 | m_archiveWriter.Close(); | ||
303 | throw; | ||
304 | } | ||
297 | 305 | ||
298 | new AssetsRequest( | 306 | new AssetsRequest( |
299 | new AssetsArchiver(m_archiveWriter), m_assetUuids.Keys, | 307 | new AssetsArchiver(m_archiveWriter), m_assetUuids.Keys, |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index 1228eb1..2c0d113 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs | |||
@@ -92,12 +92,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
92 | scene.AddCommand( | 92 | scene.AddCommand( |
93 | this, "load iar", | 93 | this, "load iar", |
94 | "load iar <first> <last> <inventory path> <password> [<archive path>]", | 94 | "load iar <first> <last> <inventory path> <password> [<archive path>]", |
95 | "Load user inventory archive. EXPERIMENTAL", HandleLoadInvConsoleCommand); | 95 | "Load user inventory archive.", HandleLoadInvConsoleCommand); |
96 | 96 | ||
97 | scene.AddCommand( | 97 | scene.AddCommand( |
98 | this, "save iar", | 98 | this, "save iar", |
99 | "save iar <first> <last> <inventory path> <password> [<archive path>]", | 99 | "save iar <first> <last> <inventory path> <password> [<archive path>]", |
100 | "Save user inventory archive. EXPERIMENTAL", HandleSaveInvConsoleCommand); | 100 | "Save user inventory archive.", HandleSaveInvConsoleCommand); |
101 | 101 | ||
102 | m_aScene = scene; | 102 | m_aScene = scene; |
103 | } | 103 | } |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index f204faf..114dd13 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | |||
@@ -103,14 +103,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
103 | List<string> serialisedSceneObjects = new List<string>(); | 103 | List<string> serialisedSceneObjects = new List<string>(); |
104 | List<string> serialisedParcels = new List<string>(); | 104 | List<string> serialisedParcels = new List<string>(); |
105 | string filePath = "NONE"; | 105 | string filePath = "NONE"; |
106 | |||
107 | TarArchiveReader archive = new TarArchiveReader(m_loadStream); | ||
108 | byte[] data; | ||
109 | TarArchiveReader.TarEntryType entryType; | ||
106 | 110 | ||
107 | try | 111 | try |
108 | { | 112 | { |
109 | TarArchiveReader archive = new TarArchiveReader(m_loadStream); | ||
110 | |||
111 | byte[] data; | ||
112 | TarArchiveReader.TarEntryType entryType; | ||
113 | |||
114 | while ((data = archive.ReadEntry(out filePath, out entryType)) != null) | 113 | while ((data = archive.ReadEntry(out filePath, out entryType)) != null) |
115 | { | 114 | { |
116 | //m_log.DebugFormat( | 115 | //m_log.DebugFormat( |
@@ -152,8 +151,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
152 | } | 151 | } |
153 | 152 | ||
154 | //m_log.Debug("[ARCHIVER]: Reached end of archive"); | 153 | //m_log.Debug("[ARCHIVER]: Reached end of archive"); |
155 | |||
156 | archive.Close(); | ||
157 | } | 154 | } |
158 | catch (Exception e) | 155 | catch (Exception e) |
159 | { | 156 | { |
@@ -163,6 +160,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
163 | m_scene.EventManager.TriggerOarFileLoaded(m_requestId, m_errorMessage); | 160 | m_scene.EventManager.TriggerOarFileLoaded(m_requestId, m_errorMessage); |
164 | return; | 161 | return; |
165 | } | 162 | } |
163 | finally | ||
164 | { | ||
165 | archive.Close(); | ||
166 | } | ||
166 | 167 | ||
167 | m_log.InfoFormat("[ARCHIVER]: Restored {0} assets", successfulAssetRestores); | 168 | m_log.InfoFormat("[ARCHIVER]: Restored {0} assets", successfulAssetRestores); |
168 | 169 | ||
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs index f039be8..75c4557 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs | |||
@@ -80,6 +80,22 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
80 | protected internal void ReceivedAllAssets( | 80 | protected internal void ReceivedAllAssets( |
81 | ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids) | 81 | ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids) |
82 | { | 82 | { |
83 | try | ||
84 | { | ||
85 | Save(assetsFoundUuids, assetsNotFoundUuids); | ||
86 | } | ||
87 | finally | ||
88 | { | ||
89 | m_archiveWriter.Close(); | ||
90 | } | ||
91 | |||
92 | m_log.InfoFormat("[ARCHIVER]: Finished writing out OAR for {0}", m_scene.RegionInfo.RegionName); | ||
93 | |||
94 | m_scene.EventManager.TriggerOarFileSaved(m_requestId, String.Empty); | ||
95 | } | ||
96 | |||
97 | protected internal void Save(ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids) | ||
98 | { | ||
83 | foreach (UUID uuid in assetsNotFoundUuids) | 99 | foreach (UUID uuid in assetsNotFoundUuids) |
84 | { | 100 | { |
85 | m_log.DebugFormat("[ARCHIVER]: Could not find asset {0}", uuid); | 101 | m_log.DebugFormat("[ARCHIVER]: Could not find asset {0}", uuid); |
@@ -143,12 +159,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
143 | } | 159 | } |
144 | 160 | ||
145 | m_log.InfoFormat("[ARCHIVER]: Added scene objects to archive."); | 161 | m_log.InfoFormat("[ARCHIVER]: Added scene objects to archive."); |
146 | |||
147 | m_archiveWriter.Close(); | ||
148 | |||
149 | m_log.InfoFormat("[ARCHIVER]: Finished writing out OAR for {0}", m_scene.RegionInfo.RegionName); | ||
150 | |||
151 | m_scene.EventManager.TriggerOarFileSaved(m_requestId, String.Empty); | ||
152 | } | 162 | } |
153 | 163 | ||
154 | /// <summary> | 164 | /// <summary> |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs index 9e4fbbe..f08d8ec 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs | |||
@@ -56,6 +56,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
56 | /// <summary> | 56 | /// <summary> |
57 | /// Constructor | 57 | /// Constructor |
58 | /// </summary> | 58 | /// </summary> |
59 | /// <param name="scene"></param> | ||
60 | /// <param name="savePath">The path to which to save data.</param> | ||
61 | /// <param name="requestId">The id associated with this request</param> | ||
62 | /// <exception cref="System.IO.IOException"> | ||
63 | /// If there was a problem opening a stream for the file specified by the savePath | ||
64 | /// </exception> | ||
59 | public ArchiveWriteRequestPreparation(Scene scene, string savePath, Guid requestId) | 65 | public ArchiveWriteRequestPreparation(Scene scene, string savePath, Guid requestId) |
60 | { | 66 | { |
61 | m_scene = scene; | 67 | m_scene = scene; |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs index 8d4f91b..181f4c6 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs | |||
@@ -45,6 +45,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
45 | 45 | ||
46 | private Scene m_scene; | 46 | private Scene m_scene; |
47 | 47 | ||
48 | /// <value> | ||
49 | /// The file used to load and save an opensimulator archive if no filename has been specified | ||
50 | /// </value> | ||
51 | protected const string DEFAULT_OAR_BACKUP_FILENAME = "region.oar"; | ||
52 | |||
48 | public string Name | 53 | public string Name |
49 | { | 54 | { |
50 | get { return "RegionArchiverModule"; } | 55 | get { return "RegionArchiverModule"; } |
@@ -80,6 +85,38 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
80 | { | 85 | { |
81 | } | 86 | } |
82 | 87 | ||
88 | /// <summary> | ||
89 | /// Load a whole region from an opensimulator archive. | ||
90 | /// </summary> | ||
91 | /// <param name="cmdparams"></param> | ||
92 | public void HandleLoadOarConsoleCommand(string module, string[] cmdparams) | ||
93 | { | ||
94 | if (cmdparams.Length > 2) | ||
95 | { | ||
96 | DearchiveRegion(cmdparams[2]); | ||
97 | } | ||
98 | else | ||
99 | { | ||
100 | DearchiveRegion(DEFAULT_OAR_BACKUP_FILENAME); | ||
101 | } | ||
102 | } | ||
103 | |||
104 | /// <summary> | ||
105 | /// Save a region to a file, including all the assets needed to restore it. | ||
106 | /// </summary> | ||
107 | /// <param name="cmdparams"></param> | ||
108 | public void HandleSaveOarConsoleCommand(string module, string[] cmdparams) | ||
109 | { | ||
110 | if (cmdparams.Length > 2) | ||
111 | { | ||
112 | ArchiveRegion(cmdparams[2]); | ||
113 | } | ||
114 | else | ||
115 | { | ||
116 | ArchiveRegion(DEFAULT_OAR_BACKUP_FILENAME); | ||
117 | } | ||
118 | } | ||
119 | |||
83 | public void ArchiveRegion(string savePath) | 120 | public void ArchiveRegion(string savePath) |
84 | { | 121 | { |
85 | ArchiveRegion(savePath, Guid.Empty); | 122 | ArchiveRegion(savePath, Guid.Empty); |
diff --git a/OpenSim/Region/Framework/Interfaces/IRegionArchiverModule.cs b/OpenSim/Region/Framework/Interfaces/IRegionArchiverModule.cs index 9ad2036..1a8babc 100644 --- a/OpenSim/Region/Framework/Interfaces/IRegionArchiverModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IRegionArchiverModule.cs | |||
@@ -34,7 +34,10 @@ namespace OpenSim.Region.Framework.Interfaces | |||
34 | /// Interface to region archive functionality | 34 | /// Interface to region archive functionality |
35 | /// </summary> | 35 | /// </summary> |
36 | public interface IRegionArchiverModule | 36 | public interface IRegionArchiverModule |
37 | { | 37 | { |
38 | void HandleLoadOarConsoleCommand(string module, string[] cmdparams); | ||
39 | void HandleSaveOarConsoleCommand(string module, string[] cmdparams); | ||
40 | |||
38 | /// <summary> | 41 | /// <summary> |
39 | /// Archive the region to the given path | 42 | /// Archive the region to the given path |
40 | /// </summary> | 43 | /// </summary> |
diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs index dfaa7ea..c2e3370 100644 --- a/OpenSim/Region/Framework/Scenes/SceneManager.cs +++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs | |||
@@ -241,24 +241,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
241 | /// Save the current scene to an OpenSimulator archive. This archive will eventually include the prim's assets | 241 | /// Save the current scene to an OpenSimulator archive. This archive will eventually include the prim's assets |
242 | /// as well as the details of the prims themselves. | 242 | /// as well as the details of the prims themselves. |
243 | /// </summary> | 243 | /// </summary> |
244 | /// <param name="filename"></param> | 244 | /// <param name="cmdparams"></param> |
245 | public void SaveCurrentSceneToArchive(string filename) | 245 | public void SaveCurrentSceneToArchive(string[] cmdparams) |
246 | { | 246 | { |
247 | IRegionArchiverModule archiver = CurrentOrFirstScene.RequestModuleInterface<IRegionArchiverModule>(); | 247 | IRegionArchiverModule archiver = CurrentOrFirstScene.RequestModuleInterface<IRegionArchiverModule>(); |
248 | if (archiver != null) | 248 | if (archiver != null) |
249 | archiver.ArchiveRegion(filename); | 249 | archiver.HandleSaveOarConsoleCommand(string.Empty, cmdparams); |
250 | } | 250 | } |
251 | 251 | ||
252 | /// <summary> | 252 | /// <summary> |
253 | /// Load an OpenSim archive into the current scene. This will load both the shapes of the prims and upload | 253 | /// Load an OpenSim archive into the current scene. This will load both the shapes of the prims and upload |
254 | /// their assets to the asset service. | 254 | /// their assets to the asset service. |
255 | /// </summary> | 255 | /// </summary> |
256 | /// <param name="filename"></param> | 256 | /// <param name="cmdparams"></param> |
257 | public void LoadArchiveToCurrentScene(string filename) | 257 | public void LoadArchiveToCurrentScene(string[] cmdparams) |
258 | { | 258 | { |
259 | IRegionArchiverModule archiver = CurrentOrFirstScene.RequestModuleInterface<IRegionArchiverModule>(); | 259 | IRegionArchiverModule archiver = CurrentOrFirstScene.RequestModuleInterface<IRegionArchiverModule>(); |
260 | if (archiver != null) | 260 | if (archiver != null) |
261 | archiver.DearchiveRegion(filename); | 261 | archiver.HandleLoadOarConsoleCommand(string.Empty, cmdparams); |
262 | } | 262 | } |
263 | 263 | ||
264 | public string SaveCurrentSceneMapToXmlString() | 264 | public string SaveCurrentSceneMapToXmlString() |