aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorDr Scofield2008-09-18 15:44:05 +0000
committerDr Scofield2008-09-18 15:44:05 +0000
commit03f246d6fea009f1812019f5f036987b96b47a2b (patch)
treef7194082d70c68a4cb64e92036d6613518fbd89c /OpenSim/Region
parentadd some comments and some try blocks around object storage (diff)
downloadopensim-SC_OLD-03f246d6fea009f1812019f5f036987b96b47a2b.zip
opensim-SC_OLD-03f246d6fea009f1812019f5f036987b96b47a2b.tar.gz
opensim-SC_OLD-03f246d6fea009f1812019f5f036987b96b47a2b.tar.bz2
opensim-SC_OLD-03f246d6fea009f1812019f5f036987b96b47a2b.tar.xz
adds support to delete a region completely and offers that
functionality via the console command "delete-region" and also via RemoteAdminPlugin. minor typo fix.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Application/OpenSim.cs30
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs31
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs7
3 files changed, 50 insertions, 18 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index e48df81..9f313eb 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -311,22 +311,23 @@ namespace OpenSim
311 break; 311 break;
312 312
313 case "remove-region": 313 case "remove-region":
314 string regName = CombineParams(cmdparams, 0); 314 string regRemoveName = CombineParams(cmdparams, 0);
315 315
316 Scene killScene; 316 Scene removeScene;
317 if (m_sceneManager.TryGetScene(regName, out killScene)) 317 if (m_sceneManager.TryGetScene(regRemoveName, out removeScene))
318 { 318 RemoveRegion(removeScene, false);
319 // only need to check this if we are not at the 319 else
320 // root level 320 m_console.Error("no region with that name");
321 if ((m_sceneManager.CurrentScene != null) && 321 break;
322 (m_sceneManager.CurrentScene.RegionInfo.RegionID == killScene.RegionInfo.RegionID))
323 {
324 m_sceneManager.TrySetCurrentScene("..");
325 }
326 322
327 m_regionData.Remove(killScene.RegionInfo); 323 case "delete-region":
328 m_sceneManager.CloseScene(killScene); 324 string regDeleteName = CombineParams(cmdparams, 0);
329 } 325
326 Scene killScene;
327 if (m_sceneManager.TryGetScene(regDeleteName, out killScene))
328 RemoveRegion(killScene, true);
329 else
330 m_console.Error("no region with that name");
330 break; 331 break;
331 332
332 case "restart": 333 case "restart":
@@ -610,6 +611,7 @@ namespace OpenSim
610 m_console.Notice("force-update - force an update of prims in the scene"); 611 m_console.Notice("force-update - force an update of prims in the scene");
611 m_console.Notice("restart - disconnects all clients and restarts the sims in the instance."); 612 m_console.Notice("restart - disconnects all clients and restarts the sims in the instance.");
612 m_console.Notice("remove-region [name] - remove a region"); 613 m_console.Notice("remove-region [name] - remove a region");
614 m_console.Notice("delete-region [name] - delete a region");
613 m_console.Notice("load-xml [filename] - load prims from XML (DEPRECATED)"); 615 m_console.Notice("load-xml [filename] - load prims from XML (DEPRECATED)");
614 m_console.Notice("save-xml [filename] - save prims to XML (DEPRECATED)"); 616 m_console.Notice("save-xml [filename] - save prims to XML (DEPRECATED)");
615 m_console.Notice("save-xml2 [filename] - save prims to XML using version 2 format"); 617 m_console.Notice("save-xml2 [filename] - save prims to XML using version 2 format");
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index 4a02264..e5cf07a 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -589,6 +589,37 @@ namespace OpenSim
589 return clientServer; 589 return clientServer;
590 } 590 }
591 591
592 public void RemoveRegion(Scene scene, bool cleanup)
593 {
594 // only need to check this if we are not at the
595 // root level
596 if ((m_sceneManager.CurrentScene != null) &&
597 (m_sceneManager.CurrentScene.RegionInfo.RegionID == scene.RegionInfo.RegionID))
598 {
599 m_sceneManager.TrySetCurrentScene("..");
600 }
601
602 scene.DeleteAllSceneObjects();
603 m_regionData.Remove(scene.RegionInfo);
604 m_sceneManager.CloseScene(scene);
605
606 if (!cleanup)
607 return;
608
609 if (!String.IsNullOrEmpty(scene.RegionInfo.RegionFile))
610 {
611 File.Delete(scene.RegionInfo.RegionFile);
612 m_log.InfoFormat("[OPENSIM MAIN] deleting region file \"{0}\"", scene.RegionInfo.RegionFile);
613 }
614 }
615
616 public void RemoveRegion(string name, bool cleanUp)
617 {
618 Scene target;
619 if (m_sceneManager.TryGetScene(name, out target))
620 RemoveRegion(target, cleanUp);
621 }
622
592 protected override StorageManager CreateStorageManager(string connectionstring, string estateconnectionstring) 623 protected override StorageManager CreateStorageManager(string connectionstring, string estateconnectionstring)
593 { 624 {
594 return new StorageManager(m_storageDll, connectionstring, estateconnectionstring); 625 return new StorageManager(m_storageDll, connectionstring, estateconnectionstring);
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 8ee2179..88f2928 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -624,7 +624,7 @@ namespace OpenSim.Region.Environment.Scenes
624 // close the inner scene 624 // close the inner scene
625 m_innerScene.Close(); 625 m_innerScene.Close();
626 // De-register with region communications (events cleanup) 626 // De-register with region communications (events cleanup)
627 UnRegisterReginWithComms(); 627 UnRegisterRegionWithComms();
628 628
629 // Shut down all non shared modules. 629 // Shut down all non shared modules.
630 foreach (IRegionModule module in Modules.Values) 630 foreach (IRegionModule module in Modules.Values)
@@ -1775,10 +1775,9 @@ namespace OpenSim.Region.Environment.Scenes
1775 /// <returns>true if the object was in the scene, false if it was not</returns> 1775 /// <returns>true if the object was in the scene, false if it was not</returns>
1776 public bool UnlinkSceneObject(UUID uuid, bool resultOfLinkingObjects) 1776 public bool UnlinkSceneObject(UUID uuid, bool resultOfLinkingObjects)
1777 { 1777 {
1778 if (m_innerScene.DeleteSceneObject(uuid,resultOfLinkingObjects)) 1778 if (m_innerScene.DeleteSceneObject(uuid, resultOfLinkingObjects))
1779 { 1779 {
1780 m_storageManager.DataStore.RemoveObject(uuid, m_regInfo.RegionID); 1780 m_storageManager.DataStore.RemoveObject(uuid, m_regInfo.RegionID);
1781
1782 return true; 1781 return true;
1783 } 1782 }
1784 1783
@@ -2568,7 +2567,7 @@ namespace OpenSim.Region.Environment.Scenes
2568 /// <summary> 2567 /// <summary>
2569 /// 2568 ///
2570 /// </summary> 2569 /// </summary>
2571 public void UnRegisterReginWithComms() 2570 public void UnRegisterRegionWithComms()
2572 { 2571 {
2573 m_sceneGridService.KiPrimitive -= SendKiPrimitive; 2572 m_sceneGridService.KiPrimitive -= SendKiPrimitive;
2574 m_sceneGridService.OnLogOffUser -= HandleLogOffUserFromGrid; 2573 m_sceneGridService.OnLogOffUser -= HandleLogOffUserFromGrid;