diff options
author | Dr Scofield | 2008-09-18 15:44:05 +0000 |
---|---|---|
committer | Dr Scofield | 2008-09-18 15:44:05 +0000 |
commit | 03f246d6fea009f1812019f5f036987b96b47a2b (patch) | |
tree | f7194082d70c68a4cb64e92036d6613518fbd89c /OpenSim | |
parent | add some comments and some try blocks around object storage (diff) | |
download | opensim-SC-03f246d6fea009f1812019f5f036987b96b47a2b.zip opensim-SC-03f246d6fea009f1812019f5f036987b96b47a2b.tar.gz opensim-SC-03f246d6fea009f1812019f5f036987b96b47a2b.tar.bz2 opensim-SC-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')
-rw-r--r-- | OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | 69 | ||||
-rw-r--r-- | OpenSim/Data/RegionProfileData.cs | 1 | ||||
-rw-r--r-- | OpenSim/Framework/RegionInfo.cs | 3 | ||||
-rw-r--r-- | OpenSim/Region/Application/OpenSim.cs | 30 | ||||
-rw-r--r-- | OpenSim/Region/Application/OpenSimBase.cs | 31 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 7 |
6 files changed, 118 insertions, 23 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index fc57386..1c924c0 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | |||
@@ -86,6 +86,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
86 | m_httpd = openSim.HttpServer; | 86 | m_httpd = openSim.HttpServer; |
87 | 87 | ||
88 | m_httpd.AddXmlRPCHandler("admin_create_region", XmlRpcCreateRegionMethod); | 88 | m_httpd.AddXmlRPCHandler("admin_create_region", XmlRpcCreateRegionMethod); |
89 | m_httpd.AddXmlRPCHandler("admin_delete_region", XmlRpcDeleteRegionMethod); | ||
89 | m_httpd.AddXmlRPCHandler("admin_shutdown", XmlRpcShutdownMethod); | 90 | m_httpd.AddXmlRPCHandler("admin_shutdown", XmlRpcShutdownMethod); |
90 | m_httpd.AddXmlRPCHandler("admin_broadcast", XmlRpcAlertMethod); | 91 | m_httpd.AddXmlRPCHandler("admin_broadcast", XmlRpcAlertMethod); |
91 | m_httpd.AddXmlRPCHandler("admin_restart", XmlRpcRestartMethod); | 92 | m_httpd.AddXmlRPCHandler("admin_restart", XmlRpcRestartMethod); |
@@ -344,8 +345,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
344 | /// <description>internal port (integer)</description></item> | 345 | /// <description>internal port (integer)</description></item> |
345 | /// <item><term>external_address</term> | 346 | /// <item><term>external_address</term> |
346 | /// <description>external IP address</description></item> | 347 | /// <description>external IP address</description></item> |
347 | /// <item><term>datastore</term> | ||
348 | /// <description>datastore parameter (?)</description></item> | ||
349 | /// <item><term>persist</term> | 348 | /// <item><term>persist</term> |
350 | /// <description>if true, persist the region info | 349 | /// <description>if true, persist the region info |
351 | /// ('true' or 'false')</description></item> | 350 | /// ('true' or 'false')</description></item> |
@@ -378,7 +377,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
378 | "region_master_first", "region_master_last", | 377 | "region_master_first", "region_master_last", |
379 | "region_master_password", | 378 | "region_master_password", |
380 | "listen_ip", "external_address"}); | 379 | "listen_ip", "external_address"}); |
381 | checkIntegerParams(request, new string[] { "region_x", "region_y", "listen_port"}); | 380 | checkIntegerParams(request, new string[] {"region_x", "region_y", "listen_port"}); |
382 | 381 | ||
383 | // check password | 382 | // check password |
384 | if (!String.IsNullOrEmpty(requiredPassword) && | 383 | if (!String.IsNullOrEmpty(requiredPassword) && |
@@ -390,7 +389,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
390 | if (requestData.ContainsKey("region_id") && | 389 | if (requestData.ContainsKey("region_id") && |
391 | !String.IsNullOrEmpty((string)requestData["region_id"])) | 390 | !String.IsNullOrEmpty((string)requestData["region_id"])) |
392 | { | 391 | { |
393 | regionID = (string) requestData["region_id"]; | 392 | regionID = (string)requestData["region_id"]; |
394 | if (m_app.SceneManager.TryGetScene(regionID, out scene)) | 393 | if (m_app.SceneManager.TryGetScene(regionID, out scene)) |
395 | throw new Exception(String.Format("region UUID already in use by region {0}, UUID {1}, <{2},{3}>", | 394 | throw new Exception(String.Format("region UUID already in use by region {0}, UUID {1}, <{2},{3}>", |
396 | scene.RegionInfo.RegionName, scene.RegionInfo.RegionID, | 395 | scene.RegionInfo.RegionName, scene.RegionInfo.RegionID, |
@@ -493,6 +492,68 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
493 | } | 492 | } |
494 | 493 | ||
495 | /// <summary> | 494 | /// <summary> |
495 | /// Delete a new region. | ||
496 | /// <summary> | ||
497 | /// <param name="request">incoming XML RPC request</param> | ||
498 | /// <remarks> | ||
499 | /// XmlRpcCreateRegionMethod takes the following XMLRPC | ||
500 | /// parameters | ||
501 | /// <list type="table"> | ||
502 | /// <listheader><term>parameter name</term><description>description</description></listheader> | ||
503 | /// <item><term>password</term> | ||
504 | /// <description>admin password as set in OpenSim.ini</description></item> | ||
505 | /// <item><term>region_name</term> | ||
506 | /// <description>desired region name</description></item> | ||
507 | /// <item><term>region_id</term> | ||
508 | /// <description>(optional) desired region UUID</description></item> | ||
509 | /// </list> | ||
510 | /// | ||
511 | /// XmlRpcCreateRegionMethod returns | ||
512 | /// <list type="table"> | ||
513 | /// <listheader><term>name</term><description>description</description></listheader> | ||
514 | /// <item><term>success</term> | ||
515 | /// <description>true or false</description></item> | ||
516 | /// <item><term>error</term> | ||
517 | /// <description>error message if success is false</description></item> | ||
518 | /// </list> | ||
519 | /// </remarks> | ||
520 | public XmlRpcResponse XmlRpcDeleteRegionMethod(XmlRpcRequest request) | ||
521 | { | ||
522 | m_log.Info("[RADMIN]: DeleteRegion: new request"); | ||
523 | XmlRpcResponse response = new XmlRpcResponse(); | ||
524 | Hashtable responseData = new Hashtable(); | ||
525 | |||
526 | try { | ||
527 | Hashtable requestData = (Hashtable) request.Params[0]; | ||
528 | checkStringParameters(request, new string[] {"password", "region_name"}); | ||
529 | |||
530 | Scene scene = null; | ||
531 | string regionName = (string)requestData["region_name"]; | ||
532 | if (!m_app.SceneManager.TryGetScene(regionName, out scene)) | ||
533 | throw new Exception(String.Format("region \"{0}\" does not exist", regionName)); | ||
534 | |||
535 | m_app.RemoveRegion(scene, true); | ||
536 | |||
537 | responseData["success"] = "true"; | ||
538 | responseData["region_name"] = regionName; | ||
539 | |||
540 | response.Value = responseData; | ||
541 | } | ||
542 | catch (Exception e) | ||
543 | { | ||
544 | m_log.ErrorFormat("[RADMIN] DeleteRegion: failed {0}", e.Message); | ||
545 | m_log.DebugFormat("[RADMIN] DeleteRegion: failed {0}", e.ToString()); | ||
546 | |||
547 | responseData["success"] = "false"; | ||
548 | responseData["error"] = e.Message; | ||
549 | |||
550 | response.Value = responseData; | ||
551 | } | ||
552 | |||
553 | return response; | ||
554 | } | ||
555 | |||
556 | /// <summary> | ||
496 | /// Create a new user account. | 557 | /// Create a new user account. |
497 | /// <summary> | 558 | /// <summary> |
498 | /// <param name="request">incoming XML RPC request</param> | 559 | /// <param name="request">incoming XML RPC request</param> |
diff --git a/OpenSim/Data/RegionProfileData.cs b/OpenSim/Data/RegionProfileData.cs index b4c7b3c..b30fcf5 100644 --- a/OpenSim/Data/RegionProfileData.cs +++ b/OpenSim/Data/RegionProfileData.cs | |||
@@ -30,7 +30,6 @@ using System.Collections; | |||
30 | using OpenMetaverse; | 30 | using OpenMetaverse; |
31 | using Nwc.XmlRpc; | 31 | using Nwc.XmlRpc; |
32 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
33 | using OpenMetaverse; | ||
34 | 33 | ||
35 | namespace OpenSim.Data | 34 | namespace OpenSim.Data |
36 | { | 35 | { |
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 925c5be..5cbc776 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs | |||
@@ -196,6 +196,7 @@ namespace OpenSim.Framework | |||
196 | public bool commFailTF = false; | 196 | public bool commFailTF = false; |
197 | public ConfigurationMember configMember; | 197 | public ConfigurationMember configMember; |
198 | public string DataStore = String.Empty; | 198 | public string DataStore = String.Empty; |
199 | public string RegionFile = String.Empty; | ||
199 | public bool isSandbox = false; | 200 | public bool isSandbox = false; |
200 | private EstateSettings m_estateSettings; | 201 | private EstateSettings m_estateSettings; |
201 | private RegionSettings m_regionSettings; | 202 | private RegionSettings m_regionSettings; |
@@ -221,6 +222,7 @@ namespace OpenSim.Framework | |||
221 | configMember = | 222 | configMember = |
222 | new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration, !skipConsoleConfig); | 223 | new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration, !skipConsoleConfig); |
223 | configMember.performConfigurationRetrieve(); | 224 | configMember.performConfigurationRetrieve(); |
225 | RegionFile = filename; | ||
224 | } | 226 | } |
225 | 227 | ||
226 | public RegionInfo(string description, XmlNode xmlNode, bool skipConsoleConfig) | 228 | public RegionInfo(string description, XmlNode xmlNode, bool skipConsoleConfig) |
@@ -364,6 +366,7 @@ namespace OpenSim.Framework | |||
364 | configMember = new ConfigurationMember(filename, description, loadConfigurationOptionsFromMe, | 366 | configMember = new ConfigurationMember(filename, description, loadConfigurationOptionsFromMe, |
365 | ignoreIncomingConfiguration, false); | 367 | ignoreIncomingConfiguration, false); |
366 | configMember.performConfigurationRetrieve(); | 368 | configMember.performConfigurationRetrieve(); |
369 | RegionFile = filename; | ||
367 | } | 370 | } |
368 | 371 | ||
369 | public void loadConfigurationOptionsFromMe() | 372 | public void loadConfigurationOptionsFromMe() |
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; |