From 03f246d6fea009f1812019f5f036987b96b47a2b Mon Sep 17 00:00:00 2001
From: Dr Scofield
Date: Thu, 18 Sep 2008 15:44:05 +0000
Subject: adds support to delete a region completely and offers that
functionality via the console command "delete-region" and also via
RemoteAdminPlugin.
minor typo fix.
---
OpenSim/Region/Application/OpenSim.cs | 30 +++++++++++++++--------------
OpenSim/Region/Application/OpenSimBase.cs | 31 ++++++++++++++++++++++++++++++
OpenSim/Region/Environment/Scenes/Scene.cs | 7 +++----
3 files changed, 50 insertions(+), 18 deletions(-)
(limited to 'OpenSim/Region')
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
break;
case "remove-region":
- string regName = CombineParams(cmdparams, 0);
+ string regRemoveName = CombineParams(cmdparams, 0);
- Scene killScene;
- if (m_sceneManager.TryGetScene(regName, out killScene))
- {
- // only need to check this if we are not at the
- // root level
- if ((m_sceneManager.CurrentScene != null) &&
- (m_sceneManager.CurrentScene.RegionInfo.RegionID == killScene.RegionInfo.RegionID))
- {
- m_sceneManager.TrySetCurrentScene("..");
- }
+ Scene removeScene;
+ if (m_sceneManager.TryGetScene(regRemoveName, out removeScene))
+ RemoveRegion(removeScene, false);
+ else
+ m_console.Error("no region with that name");
+ break;
- m_regionData.Remove(killScene.RegionInfo);
- m_sceneManager.CloseScene(killScene);
- }
+ case "delete-region":
+ string regDeleteName = CombineParams(cmdparams, 0);
+
+ Scene killScene;
+ if (m_sceneManager.TryGetScene(regDeleteName, out killScene))
+ RemoveRegion(killScene, true);
+ else
+ m_console.Error("no region with that name");
break;
case "restart":
@@ -610,6 +611,7 @@ namespace OpenSim
m_console.Notice("force-update - force an update of prims in the scene");
m_console.Notice("restart - disconnects all clients and restarts the sims in the instance.");
m_console.Notice("remove-region [name] - remove a region");
+ m_console.Notice("delete-region [name] - delete a region");
m_console.Notice("load-xml [filename] - load prims from XML (DEPRECATED)");
m_console.Notice("save-xml [filename] - save prims to XML (DEPRECATED)");
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
return clientServer;
}
+ public void RemoveRegion(Scene scene, bool cleanup)
+ {
+ // only need to check this if we are not at the
+ // root level
+ if ((m_sceneManager.CurrentScene != null) &&
+ (m_sceneManager.CurrentScene.RegionInfo.RegionID == scene.RegionInfo.RegionID))
+ {
+ m_sceneManager.TrySetCurrentScene("..");
+ }
+
+ scene.DeleteAllSceneObjects();
+ m_regionData.Remove(scene.RegionInfo);
+ m_sceneManager.CloseScene(scene);
+
+ if (!cleanup)
+ return;
+
+ if (!String.IsNullOrEmpty(scene.RegionInfo.RegionFile))
+ {
+ File.Delete(scene.RegionInfo.RegionFile);
+ m_log.InfoFormat("[OPENSIM MAIN] deleting region file \"{0}\"", scene.RegionInfo.RegionFile);
+ }
+ }
+
+ public void RemoveRegion(string name, bool cleanUp)
+ {
+ Scene target;
+ if (m_sceneManager.TryGetScene(name, out target))
+ RemoveRegion(target, cleanUp);
+ }
+
protected override StorageManager CreateStorageManager(string connectionstring, string estateconnectionstring)
{
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
// close the inner scene
m_innerScene.Close();
// De-register with region communications (events cleanup)
- UnRegisterReginWithComms();
+ UnRegisterRegionWithComms();
// Shut down all non shared modules.
foreach (IRegionModule module in Modules.Values)
@@ -1775,10 +1775,9 @@ namespace OpenSim.Region.Environment.Scenes
/// true if the object was in the scene, false if it was not
public bool UnlinkSceneObject(UUID uuid, bool resultOfLinkingObjects)
{
- if (m_innerScene.DeleteSceneObject(uuid,resultOfLinkingObjects))
+ if (m_innerScene.DeleteSceneObject(uuid, resultOfLinkingObjects))
{
m_storageManager.DataStore.RemoveObject(uuid, m_regInfo.RegionID);
-
return true;
}
@@ -2568,7 +2567,7 @@ namespace OpenSim.Region.Environment.Scenes
///
///
///
- public void UnRegisterReginWithComms()
+ public void UnRegisterRegionWithComms()
{
m_sceneGridService.KiPrimitive -= SendKiPrimitive;
m_sceneGridService.OnLogOffUser -= HandleLogOffUserFromGrid;
--
cgit v1.1