diff options
author | Justin Clark-Casey (justincc) | 2010-09-03 22:38:40 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-09-03 22:38:40 +0100 |
commit | b8da15c10448993a0bb81e8d1b1a31250515c1eb (patch) | |
tree | 55347dc096d139e3a12665ea8bef26f3ede55e4a /OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC-b8da15c10448993a0bb81e8d1b1a31250515c1eb.zip opensim-SC-b8da15c10448993a0bb81e8d1b1a31250515c1eb.tar.gz opensim-SC-b8da15c10448993a0bb81e8d1b1a31250515c1eb.tar.bz2 opensim-SC-b8da15c10448993a0bb81e8d1b1a31250515c1eb.tar.xz |
In RemoveAdminPlugin, use a .ini file template in XmlRpcCreateRegionMethod rather than an older XML one
This is a patch from http://opensimulator.org/mantis/view.php?id=4973. Thanks randomhuman
Diffstat (limited to 'OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs')
-rw-r--r-- | OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index da3d3c2..c713e19 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | |||
@@ -470,6 +470,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
470 | /// <item><term>estate_name</term> | 470 | /// <item><term>estate_name</term> |
471 | /// <description>the name of the estate to join (or to create if it doesn't | 471 | /// <description>the name of the estate to join (or to create if it doesn't |
472 | /// already exist)</description></item> | 472 | /// already exist)</description></item> |
473 | /// <item><term>region_file</term> | ||
474 | /// <description>The name of the file to persist the region specifications to. | ||
475 | /// If omitted, the region_file_template setting from OpenSim.ini will be used. (optional)</description></item> | ||
473 | /// </list> | 476 | /// </list> |
474 | /// | 477 | /// |
475 | /// XmlRpcCreateRegionMethod returns | 478 | /// XmlRpcCreateRegionMethod returns |
@@ -583,7 +586,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
583 | bool persist = Convert.ToBoolean((string) requestData["persist"]); | 586 | bool persist = Convert.ToBoolean((string) requestData["persist"]); |
584 | if (persist) | 587 | if (persist) |
585 | { | 588 | { |
586 | // default place for region XML files is in the | 589 | // default place for region configuration files is in the |
587 | // Regions directory of the config dir (aka /bin) | 590 | // Regions directory of the config dir (aka /bin) |
588 | string regionConfigPath = Path.Combine(Util.configDir(), "Regions"); | 591 | string regionConfigPath = Path.Combine(Util.configDir(), "Regions"); |
589 | try | 592 | try |
@@ -596,19 +599,36 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
596 | { | 599 | { |
597 | // No INI setting recorded. | 600 | // No INI setting recorded. |
598 | } | 601 | } |
599 | string regionXmlPath = Path.Combine(regionConfigPath, | 602 | |
603 | string regionIniPath; | ||
604 | |||
605 | if (requestData.Contains("region_file")) | ||
606 | { | ||
607 | // Make sure that the file to be created is in a subdirectory of the region storage directory. | ||
608 | string requestedFilePath = Path.Combine(regionConfigPath, (string) requestData["region_file"]); | ||
609 | string requestedDirectory = Path.GetDirectoryName(Path.GetFullPath(requestedFilePath)); | ||
610 | if (requestedDirectory.StartsWith(Path.GetFullPath(regionConfigPath))) | ||
611 | regionIniPath = requestedFilePath; | ||
612 | else | ||
613 | throw new Exception("Invalid location for region file."); | ||
614 | } | ||
615 | else | ||
616 | { | ||
617 | regionIniPath = Path.Combine(regionConfigPath, | ||
600 | String.Format( | 618 | String.Format( |
601 | m_config.GetString("region_file_template", | 619 | m_config.GetString("region_file_template", |
602 | "{0}x{1}-{2}.xml"), | 620 | "{0}x{1}-{2}.ini"), |
603 | region.RegionLocX.ToString(), | 621 | region.RegionLocX.ToString(), |
604 | region.RegionLocY.ToString(), | 622 | region.RegionLocY.ToString(), |
605 | regionID.ToString(), | 623 | regionID.ToString(), |
606 | region.InternalEndPoint.Port.ToString(), | 624 | region.InternalEndPoint.Port.ToString(), |
607 | region.RegionName.Replace(" ", "_").Replace(":", "_"). | 625 | region.RegionName.Replace(" ", "_").Replace(":", "_"). |
608 | Replace("/", "_"))); | 626 | Replace("/", "_"))); |
627 | } | ||
628 | |||
609 | m_log.DebugFormat("[RADMIN] CreateRegion: persisting region {0} to {1}", | 629 | m_log.DebugFormat("[RADMIN] CreateRegion: persisting region {0} to {1}", |
610 | region.RegionID, regionXmlPath); | 630 | region.RegionID, regionIniPath); |
611 | region.SaveRegionToFile("dynamic region", regionXmlPath); | 631 | region.SaveRegionToFile("dynamic region", regionIniPath); |
612 | } | 632 | } |
613 | else | 633 | else |
614 | { | 634 | { |