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 randomhumanprebuild-update
parent
9b95bd259f
commit
b8da15c104
|
@ -470,6 +470,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
/// <item><term>estate_name</term>
|
/// <item><term>estate_name</term>
|
||||||
/// <description>the name of the estate to join (or to create if it doesn't
|
/// <description>the name of the estate to join (or to create if it doesn't
|
||||||
/// already exist)</description></item>
|
/// already exist)</description></item>
|
||||||
|
/// <item><term>region_file</term>
|
||||||
|
/// <description>The name of the file to persist the region specifications to.
|
||||||
|
/// If omitted, the region_file_template setting from OpenSim.ini will be used. (optional)</description></item>
|
||||||
/// </list>
|
/// </list>
|
||||||
///
|
///
|
||||||
/// XmlRpcCreateRegionMethod returns
|
/// XmlRpcCreateRegionMethod returns
|
||||||
|
@ -583,7 +586,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
bool persist = Convert.ToBoolean((string) requestData["persist"]);
|
bool persist = Convert.ToBoolean((string) requestData["persist"]);
|
||||||
if (persist)
|
if (persist)
|
||||||
{
|
{
|
||||||
// default place for region XML files is in the
|
// default place for region configuration files is in the
|
||||||
// Regions directory of the config dir (aka /bin)
|
// Regions directory of the config dir (aka /bin)
|
||||||
string regionConfigPath = Path.Combine(Util.configDir(), "Regions");
|
string regionConfigPath = Path.Combine(Util.configDir(), "Regions");
|
||||||
try
|
try
|
||||||
|
@ -596,19 +599,36 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
{
|
{
|
||||||
// No INI setting recorded.
|
// No INI setting recorded.
|
||||||
}
|
}
|
||||||
string regionXmlPath = Path.Combine(regionConfigPath,
|
|
||||||
|
string regionIniPath;
|
||||||
|
|
||||||
|
if (requestData.Contains("region_file"))
|
||||||
|
{
|
||||||
|
// Make sure that the file to be created is in a subdirectory of the region storage directory.
|
||||||
|
string requestedFilePath = Path.Combine(regionConfigPath, (string) requestData["region_file"]);
|
||||||
|
string requestedDirectory = Path.GetDirectoryName(Path.GetFullPath(requestedFilePath));
|
||||||
|
if (requestedDirectory.StartsWith(Path.GetFullPath(regionConfigPath)))
|
||||||
|
regionIniPath = requestedFilePath;
|
||||||
|
else
|
||||||
|
throw new Exception("Invalid location for region file.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
regionIniPath = Path.Combine(regionConfigPath,
|
||||||
String.Format(
|
String.Format(
|
||||||
m_config.GetString("region_file_template",
|
m_config.GetString("region_file_template",
|
||||||
"{0}x{1}-{2}.xml"),
|
"{0}x{1}-{2}.ini"),
|
||||||
region.RegionLocX.ToString(),
|
region.RegionLocX.ToString(),
|
||||||
region.RegionLocY.ToString(),
|
region.RegionLocY.ToString(),
|
||||||
regionID.ToString(),
|
regionID.ToString(),
|
||||||
region.InternalEndPoint.Port.ToString(),
|
region.InternalEndPoint.Port.ToString(),
|
||||||
region.RegionName.Replace(" ", "_").Replace(":", "_").
|
region.RegionName.Replace(" ", "_").Replace(":", "_").
|
||||||
Replace("/", "_")));
|
Replace("/", "_")));
|
||||||
|
}
|
||||||
|
|
||||||
m_log.DebugFormat("[RADMIN] CreateRegion: persisting region {0} to {1}",
|
m_log.DebugFormat("[RADMIN] CreateRegion: persisting region {0} to {1}",
|
||||||
region.RegionID, regionXmlPath);
|
region.RegionID, regionIniPath);
|
||||||
region.SaveRegionToFile("dynamic region", regionXmlPath);
|
region.SaveRegionToFile("dynamic region", regionIniPath);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -805,7 +805,7 @@ namespace OpenSim.Framework
|
||||||
IConfig config = source.Configs[RegionName];
|
IConfig config = source.Configs[RegionName];
|
||||||
|
|
||||||
if (config != null)
|
if (config != null)
|
||||||
source.Configs.Remove(RegionName);
|
source.Configs.Remove(config);
|
||||||
|
|
||||||
config = source.AddConfig(RegionName);
|
config = source.AddConfig(RegionName);
|
||||||
|
|
||||||
|
@ -864,11 +864,16 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else if (filename.ToLower().EndsWith(".xml"))
|
||||||
|
{
|
||||||
configMember = new ConfigurationMember(filename, description, loadConfigurationOptionsFromMe,
|
configMember = new ConfigurationMember(filename, description, loadConfigurationOptionsFromMe,
|
||||||
ignoreIncomingConfiguration, false);
|
ignoreIncomingConfiguration, false);
|
||||||
configMember.performConfigurationRetrieve();
|
configMember.performConfigurationRetrieve();
|
||||||
RegionFile = filename;
|
RegionFile = filename;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
throw new Exception("Invalid file type for region persistence.");
|
||||||
|
}
|
||||||
|
|
||||||
public void loadConfigurationOptionsFromMe()
|
public void loadConfigurationOptionsFromMe()
|
||||||
{
|
{
|
||||||
|
|
|
@ -640,7 +640,7 @@
|
||||||
; {2} - region UUID
|
; {2} - region UUID
|
||||||
; {3} - region port
|
; {3} - region port
|
||||||
; {4} - region name with " ", ":", "/" mapped to "_"
|
; {4} - region name with " ", ":", "/" mapped to "_"
|
||||||
region_file_template = "{0}x{1}-{2}.xml"
|
region_file_template = "{0}x{1}-{2}.ini"
|
||||||
|
|
||||||
; we can limit the number of regions that XmlRpcCreateRegion will
|
; we can limit the number of regions that XmlRpcCreateRegion will
|
||||||
; allow by setting this to a positive, non-0 number: as long as the
|
; allow by setting this to a positive, non-0 number: as long as the
|
||||||
|
|
Loading…
Reference in New Issue