aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-09-03 22:38:40 +0100
committerJustin Clark-Casey (justincc)2010-09-03 22:38:40 +0100
commitb8da15c10448993a0bb81e8d1b1a31250515c1eb (patch)
tree55347dc096d139e3a12665ea8bef26f3ede55e4a
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-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
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs30
-rw-r--r--OpenSim/Framework/RegionInfo.cs15
-rw-r--r--bin/OpenSim.ini.example2
3 files changed, 36 insertions, 11 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 {
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index ea1a594..12c58c3 100644
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -805,7 +805,7 @@ namespace OpenSim.Framework
805 IConfig config = source.Configs[RegionName]; 805 IConfig config = source.Configs[RegionName];
806 806
807 if (config != null) 807 if (config != null)
808 source.Configs.Remove(RegionName); 808 source.Configs.Remove(config);
809 809
810 config = source.AddConfig(RegionName); 810 config = source.AddConfig(RegionName);
811 811
@@ -864,10 +864,15 @@ namespace OpenSim.Framework
864 864
865 return; 865 return;
866 } 866 }
867 configMember = new ConfigurationMember(filename, description, loadConfigurationOptionsFromMe, 867 else if (filename.ToLower().EndsWith(".xml"))
868 ignoreIncomingConfiguration, false); 868 {
869 configMember.performConfigurationRetrieve(); 869 configMember = new ConfigurationMember(filename, description, loadConfigurationOptionsFromMe,
870 RegionFile = filename; 870 ignoreIncomingConfiguration, false);
871 configMember.performConfigurationRetrieve();
872 RegionFile = filename;
873 }
874 else
875 throw new Exception("Invalid file type for region persistence.");
871 } 876 }
872 877
873 public void loadConfigurationOptionsFromMe() 878 public void loadConfigurationOptionsFromMe()
diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example
index 71c7e55..08726ea 100644
--- a/bin/OpenSim.ini.example
+++ b/bin/OpenSim.ini.example
@@ -640,7 +640,7 @@
640 ; {2} - region UUID 640 ; {2} - region UUID
641 ; {3} - region port 641 ; {3} - region port
642 ; {4} - region name with " ", ":", "/" mapped to "_" 642 ; {4} - region name with " ", ":", "/" mapped to "_"
643 region_file_template = "{0}x{1}-{2}.xml" 643 region_file_template = "{0}x{1}-{2}.ini"
644 644
645 ; we can limit the number of regions that XmlRpcCreateRegion will 645 ; we can limit the number of regions that XmlRpcCreateRegion will
646 ; allow by setting this to a positive, non-0 number: as long as the 646 ; allow by setting this to a positive, non-0 number: as long as the