diff --git a/OpenSim/Data/MSSQL/MSSQLEstateData.cs b/OpenSim/Data/MSSQL/MSSQLEstateData.cs
index 6f6f076e68..1624f56a20 100644
--- a/OpenSim/Data/MSSQL/MSSQLEstateData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLEstateData.cs
@@ -83,7 +83,7 @@ namespace OpenSim.Data.MSSQL
///
/// region ID.
///
- public EstateSettings LoadEstateSettings(UUID regionID)
+ public EstateSettings LoadEstateSettings(UUID regionID, bool create)
{
EstateSettings es = new EstateSettings();
@@ -127,7 +127,7 @@ namespace OpenSim.Data.MSSQL
}
- if (insertEstate)
+ if (insertEstate && create)
{
List names = new List(FieldList);
@@ -173,25 +173,6 @@ namespace OpenSim.Data.MSSQL
}
}
- // Munge and transfer the ban list
-
- sql = string.Format("insert into estateban select {0}, bannedUUID, bannedIp, bannedIpHostMask, '' from regionban where regionban.regionUUID = @UUID", es.EstateID);
- using (SqlConnection conn = new SqlConnection(m_connectionString))
- using (SqlCommand cmd = new SqlCommand(sql, conn))
- {
-
- cmd.Parameters.Add(_Database.CreateParameter("@UUID", regionID));
- try
- {
- conn.Open();
- cmd.ExecuteNonQuery();
- }
- catch (Exception)
- {
- _Log.Debug("[ESTATE DB]: Error setting up estateban from regionban");
- }
- }
-
//TODO check if this is needed??
es.Save();
}
diff --git a/OpenSim/Data/MySQL/MySQLEstateData.cs b/OpenSim/Data/MySQL/MySQLEstateData.cs
index 2eae2d82b2..e94dcda2bb 100644
--- a/OpenSim/Data/MySQL/MySQLEstateData.cs
+++ b/OpenSim/Data/MySQL/MySQLEstateData.cs
@@ -121,7 +121,7 @@ namespace OpenSim.Data.MySQL
}
}
- public EstateSettings LoadEstateSettings(UUID regionID)
+ public EstateSettings LoadEstateSettings(UUID regionID, bool create)
{
EstateSettings es = new EstateSettings();
es.OnSave += StoreEstateSettings;
@@ -129,12 +129,12 @@ namespace OpenSim.Data.MySQL
string sql = "select estate_settings." + String.Join(",estate_settings.", FieldList) +
" from estate_map left join estate_settings on estate_map.EstateID = estate_settings.EstateID where estate_settings.EstateID is not null and RegionID = ?RegionID";
- bool migration = true;
-
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
+ bool found = false;
+
using (MySqlCommand cmd = dbcon.CreateCommand())
{
cmd.CommandText = sql;
@@ -144,7 +144,7 @@ namespace OpenSim.Data.MySQL
{
if (r.Read())
{
- migration = false;
+ found = true;
foreach (string name in FieldList)
{
@@ -172,7 +172,7 @@ namespace OpenSim.Data.MySQL
}
}
- if (migration)
+ if (!found && create)
{
// Migration case
List names = new List(FieldList);
@@ -220,14 +220,6 @@ namespace OpenSim.Data.MySQL
try { cmd.ExecuteNonQuery(); }
catch (Exception) { }
- // Munge and transfer the ban list
- cmd.Parameters.Clear();
- cmd.CommandText = "insert into estateban select " + es.EstateID.ToString() + ", bannedUUID, bannedIp, bannedIpHostMask, '' from regionban where regionban.regionUUID = ?UUID";
- cmd.Parameters.AddWithValue("?UUID", regionID.ToString());
-
- try { cmd.ExecuteNonQuery(); }
- catch (Exception) { }
-
es.Save();
}
}
diff --git a/OpenSim/Data/SQLite/SQLiteEstateData.cs b/OpenSim/Data/SQLite/SQLiteEstateData.cs
index 1be99eedab..4a447d26d1 100644
--- a/OpenSim/Data/SQLite/SQLiteEstateData.cs
+++ b/OpenSim/Data/SQLite/SQLiteEstateData.cs
@@ -80,7 +80,7 @@ namespace OpenSim.Data.SQLite
get { return new List(m_FieldMap.Keys).ToArray(); }
}
- public EstateSettings LoadEstateSettings(UUID regionID)
+ public EstateSettings LoadEstateSettings(UUID regionID, bool create)
{
EstateSettings es = new EstateSettings();
es.OnSave += StoreEstateSettings;
@@ -120,10 +120,8 @@ namespace OpenSim.Data.SQLite
}
r.Close();
}
- else
+ else if (create)
{
- // Migration case
- //
r.Close();
List names = new List(FieldList);
@@ -176,20 +174,6 @@ namespace OpenSim.Data.SQLite
{
}
- // Munge and transfer the ban list
- //
- cmd.Parameters.Clear();
- cmd.CommandText = "insert into estateban select "+es.EstateID.ToString()+", bannedUUID, bannedIp, bannedIpHostMask, '' from regionban where regionban.regionUUID = :UUID";
- cmd.Parameters.Add(":UUID", regionID.ToString());
-
- try
- {
- cmd.ExecuteNonQuery();
- }
- catch (Exception)
- {
- }
-
es.Save();
}
diff --git a/OpenSim/Data/Tests/BasicEstateTest.cs b/OpenSim/Data/Tests/BasicEstateTest.cs
index 907bb382c6..d14d405256 100644
--- a/OpenSim/Data/Tests/BasicEstateTest.cs
+++ b/OpenSim/Data/Tests/BasicEstateTest.cs
@@ -158,7 +158,7 @@ namespace OpenSim.Data.Tests
public void T012_EstateSettingsRandomStorage()
{
// Letting estate store generate rows to database for us
- EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID);
+ EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true);
new PropertyScrambler()
.DontScramble(x=>x.EstateID)
.Scramble(originalSettings);
@@ -167,7 +167,7 @@ namespace OpenSim.Data.Tests
db.StoreEstateSettings(originalSettings);
// Loading settings to another instance variable.
- EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID);
+ EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID, true);
// Checking that loaded values are correct.
Assert.That(loadedSettings, Constraints.PropertyCompareConstraint(originalSettings));
@@ -177,7 +177,7 @@ namespace OpenSim.Data.Tests
public void T020_EstateSettingsManagerList()
{
// Letting estate store generate rows to database for us
- EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID);
+ EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true);
originalSettings.EstateManagers = new UUID[] { MANAGER_ID_1, MANAGER_ID_2 };
@@ -185,7 +185,7 @@ namespace OpenSim.Data.Tests
db.StoreEstateSettings(originalSettings);
// Loading settings to another instance variable.
- EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID);
+ EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID, true);
Assert.AreEqual(2, loadedSettings.EstateManagers.Length);
Assert.AreEqual(MANAGER_ID_1, loadedSettings.EstateManagers[0]);
@@ -196,7 +196,7 @@ namespace OpenSim.Data.Tests
public void T021_EstateSettingsUserList()
{
// Letting estate store generate rows to database for us
- EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID);
+ EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true);
originalSettings.EstateAccess = new UUID[] { USER_ID_1, USER_ID_2 };
@@ -204,7 +204,7 @@ namespace OpenSim.Data.Tests
db.StoreEstateSettings(originalSettings);
// Loading settings to another instance variable.
- EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID);
+ EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID, true);
Assert.AreEqual(2, loadedSettings.EstateAccess.Length);
Assert.AreEqual(USER_ID_1, loadedSettings.EstateAccess[0]);
@@ -215,7 +215,7 @@ namespace OpenSim.Data.Tests
public void T022_EstateSettingsGroupList()
{
// Letting estate store generate rows to database for us
- EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID);
+ EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true);
originalSettings.EstateGroups = new UUID[] { GROUP_ID_1, GROUP_ID_2 };
@@ -223,7 +223,7 @@ namespace OpenSim.Data.Tests
db.StoreEstateSettings(originalSettings);
// Loading settings to another instance variable.
- EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID);
+ EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID, true);
Assert.AreEqual(2, loadedSettings.EstateAccess.Length);
Assert.AreEqual(GROUP_ID_1, loadedSettings.EstateGroups[0]);
@@ -234,7 +234,7 @@ namespace OpenSim.Data.Tests
public void T022_EstateSettingsBanList()
{
// Letting estate store generate rows to database for us
- EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID);
+ EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true);
EstateBan estateBan1 = new EstateBan();
estateBan1.BannedUserID = DataTestUtil.UUID_MIN;
@@ -248,7 +248,7 @@ namespace OpenSim.Data.Tests
db.StoreEstateSettings(originalSettings);
// Loading settings to another instance variable.
- EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID);
+ EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID, true);
Assert.AreEqual(2, loadedSettings.EstateBans.Length);
Assert.AreEqual(DataTestUtil.UUID_MIN, loadedSettings.EstateBans[0].BannedUserID);
@@ -290,7 +290,7 @@ namespace OpenSim.Data.Tests
{
// Letting estate store generate rows to database for us
- EstateSettings originalSettings = db.LoadEstateSettings(regionId);
+ EstateSettings originalSettings = db.LoadEstateSettings(regionId, true);
SetEstateSettings(
originalSettings,
@@ -347,7 +347,7 @@ namespace OpenSim.Data.Tests
db.StoreEstateSettings(originalSettings);
// Loading settings to another instance variable.
- EstateSettings loadedSettings = db.LoadEstateSettings(regionId);
+ EstateSettings loadedSettings = db.LoadEstateSettings(regionId, true);
// Checking that loaded values are correct.
ValidateEstateSettings(
diff --git a/OpenSim/Framework/EstateSettings.cs b/OpenSim/Framework/EstateSettings.cs
index b4b5808ad3..2a495b0e8c 100644
--- a/OpenSim/Framework/EstateSettings.cs
+++ b/OpenSim/Framework/EstateSettings.cs
@@ -35,7 +35,6 @@ namespace OpenSim.Framework
public class EstateSettings
{
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
- private readonly ConfigurationMember configMember;
public delegate void SaveDelegate(EstateSettings rs);
@@ -43,7 +42,7 @@ namespace OpenSim.Framework
// Only the client uses these
//
- private uint m_EstateID = 100;
+ private uint m_EstateID = 0;
public uint EstateID
{
@@ -51,7 +50,7 @@ namespace OpenSim.Framework
set { m_EstateID = value; }
}
- private string m_EstateName;
+ private string m_EstateName = "My Estate";
public string EstateName
{
@@ -59,7 +58,7 @@ namespace OpenSim.Framework
set { m_EstateName = value; }
}
- private uint m_ParentEstateID = 100;
+ private uint m_ParentEstateID = 1;
public uint ParentEstateID
{
@@ -67,7 +66,7 @@ namespace OpenSim.Framework
set { m_ParentEstateID = value; }
}
- private float m_BillableFactor;
+ private float m_BillableFactor = 0.0f;
public float BillableFactor
{
@@ -75,7 +74,7 @@ namespace OpenSim.Framework
set { m_BillableFactor = value; }
}
- private int m_PricePerMeter;
+ private int m_PricePerMeter = 1;
public int PricePerMeter
{
@@ -83,7 +82,7 @@ namespace OpenSim.Framework
set { m_PricePerMeter = value; }
}
- private int m_RedirectGridX;
+ private int m_RedirectGridX = 0;
public int RedirectGridX
{
@@ -91,7 +90,7 @@ namespace OpenSim.Framework
set { m_RedirectGridX = value; }
}
- private int m_RedirectGridY;
+ private int m_RedirectGridY = 0;
public int RedirectGridY
{
@@ -273,25 +272,6 @@ namespace OpenSim.Framework
public EstateSettings()
{
- if (configMember == null)
- {
- try
- {
- // Load legacy defaults
- //
- configMember =
- new ConfigurationMember(Path.Combine(Util.configDir(),
- "estate_settings.xml"), "ESTATE SETTINGS",
- loadConfigurationOptions,
- handleIncomingConfiguration, true);
-
- l_EstateManagers.Clear();
- configMember.performConfigurationRetrieve();
- }
- catch (Exception)
- {
- }
- }
}
public void Save()
@@ -393,165 +373,5 @@ namespace OpenSim.Framework
return l_EstateAccess.Contains(user);
}
-
- public void loadConfigurationOptions()
- {
- configMember.addConfigurationOption("billable_factor",
- ConfigurationOption.ConfigurationTypes.TYPE_FLOAT,
- String.Empty, "0.0", true);
-
-// configMember.addConfigurationOption("estate_id",
-// ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
-// String.Empty, "100", true);
-
-// configMember.addConfigurationOption("parent_estate_id",
-// ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
-// String.Empty, "1", true);
-
- configMember.addConfigurationOption("redirect_grid_x",
- ConfigurationOption.ConfigurationTypes.TYPE_INT32,
- String.Empty, "0", true);
-
- configMember.addConfigurationOption("redirect_grid_y",
- ConfigurationOption.ConfigurationTypes.TYPE_INT32,
- String.Empty, "0", true);
-
- configMember.addConfigurationOption("price_per_meter",
- ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
- String.Empty, "1", true);
-
- configMember.addConfigurationOption("estate_name",
- ConfigurationOption.ConfigurationTypes.TYPE_STRING,
- String.Empty, "My Estate", true);
-
- configMember.addConfigurationOption("estate_manager_0",
- ConfigurationOption.ConfigurationTypes.TYPE_UUID,
- String.Empty, "00000000-0000-0000-0000-000000000000", true);
-
- configMember.addConfigurationOption("estate_manager_1",
- ConfigurationOption.ConfigurationTypes.TYPE_UUID,
- String.Empty, "00000000-0000-0000-0000-000000000000", true);
-
- configMember.addConfigurationOption("estate_manager_2",
- ConfigurationOption.ConfigurationTypes.TYPE_UUID,
- String.Empty, "00000000-0000-0000-0000-000000000000", true);
-
- configMember.addConfigurationOption("estate_manager_3",
- ConfigurationOption.ConfigurationTypes.TYPE_UUID,
- String.Empty, "00000000-0000-0000-0000-000000000000", true);
-
- configMember.addConfigurationOption("estate_manager_4",
- ConfigurationOption.ConfigurationTypes.TYPE_UUID,
- String.Empty, "00000000-0000-0000-0000-000000000000", true);
-
- configMember.addConfigurationOption("estate_manager_5",
- ConfigurationOption.ConfigurationTypes.TYPE_UUID,
- String.Empty, "00000000-0000-0000-0000-000000000000", true);
-
- configMember.addConfigurationOption("estate_manager_6",
- ConfigurationOption.ConfigurationTypes.TYPE_UUID,
- String.Empty, "00000000-0000-0000-0000-000000000000", true);
-
- configMember.addConfigurationOption("estate_manager_7",
- ConfigurationOption.ConfigurationTypes.TYPE_UUID,
- String.Empty, "00000000-0000-0000-0000-000000000000", true);
-
- configMember.addConfigurationOption("estate_manager_8",
- ConfigurationOption.ConfigurationTypes.TYPE_UUID,
- String.Empty, "00000000-0000-0000-0000-000000000000", true);
-
- configMember.addConfigurationOption("estate_manager_9",
- ConfigurationOption.ConfigurationTypes.TYPE_UUID,
- String.Empty, "00000000-0000-0000-0000-000000000000", true);
-
- configMember.addConfigurationOption("region_flags",
- ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
- String.Empty, "336723974", true);
- }
-
- public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
- {
- switch (configuration_key)
- {
- case "region_flags":
- RegionFlags flags = (RegionFlags)(uint)configuration_result;
- if ((flags & (RegionFlags)(1<<29)) != 0)
- m_AllowVoice = true;
- if ((flags & RegionFlags.AllowDirectTeleport) != 0)
- m_AllowDirectTeleport = true;
- if ((flags & RegionFlags.DenyAnonymous) != 0)
- m_DenyAnonymous = true;
- if ((flags & RegionFlags.DenyIdentified) != 0)
- m_DenyIdentified = true;
- if ((flags & RegionFlags.DenyTransacted) != 0)
- m_DenyTransacted = true;
- if ((flags & RegionFlags.AbuseEmailToEstateOwner) != 0)
- m_AbuseEmailToEstateOwner = true;
- if ((flags & RegionFlags.BlockDwell) != 0)
- m_BlockDwell = true;
- if ((flags & RegionFlags.EstateSkipScripts) != 0)
- m_EstateSkipScripts = true;
- if ((flags & RegionFlags.ResetHomeOnTeleport) != 0)
- m_ResetHomeOnTeleport = true;
- if ((flags & RegionFlags.TaxFree) != 0)
- m_TaxFree = true;
- if ((flags & RegionFlags.PublicAllowed) != 0)
- m_PublicAccess = true;
- break;
- case "billable_factor":
- m_BillableFactor = (float) configuration_result;
- break;
-// case "estate_id":
-// m_EstateID = (uint) configuration_result;
-// break;
-// case "parent_estate_id":
-// m_ParentEstateID = (uint) configuration_result;
-// break;
- case "redirect_grid_x":
- m_RedirectGridX = (int) configuration_result;
- break;
- case "redirect_grid_y":
- m_RedirectGridY = (int) configuration_result;
- break;
- case "price_per_meter":
- m_PricePerMeter = Convert.ToInt32(configuration_result);
- break;
- case "estate_name":
- m_EstateName = (string) configuration_result;
- break;
- case "estate_manager_0":
- AddEstateManager((UUID)configuration_result);
- break;
- case "estate_manager_1":
- AddEstateManager((UUID)configuration_result);
- break;
- case "estate_manager_2":
- AddEstateManager((UUID)configuration_result);
- break;
- case "estate_manager_3":
- AddEstateManager((UUID)configuration_result);
- break;
- case "estate_manager_4":
- AddEstateManager((UUID)configuration_result);
- break;
- case "estate_manager_5":
- AddEstateManager((UUID)configuration_result);
- break;
- case "estate_manager_6":
- AddEstateManager((UUID)configuration_result);
- break;
- case "estate_manager_7":
- AddEstateManager((UUID)configuration_result);
- break;
- case "estate_manager_8":
- AddEstateManager((UUID)configuration_result);
- break;
- case "estate_manager_9":
- AddEstateManager((UUID)configuration_result);
- break;
- }
-
- return true;
- }
}
}
diff --git a/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs b/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs
index 668ff98f7b..6861544c84 100644
--- a/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs
@@ -34,7 +34,7 @@ namespace OpenSim.Region.Framework.Interfaces
{
void Initialise(string connectstring);
- EstateSettings LoadEstateSettings(UUID regionID);
+ EstateSettings LoadEstateSettings(UUID regionID, bool create);
void StoreEstateSettings(EstateSettings es);
}
}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 2080687f2c..078cf030e2 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -604,7 +604,7 @@ namespace OpenSim.Region.Framework.Scenes
m_regInfo.RegionSettings = m_storageManager.DataStore.LoadRegionSettings(m_regInfo.RegionID);
if (m_storageManager.EstateDataStore != null)
{
- m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID);
+ m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, true);
}
//Bind Storage Manager functions to some land manager functions for this scene