Remove the reading of estate_settings.xml and the associated processing of

defaults. Adding code to facilitate estate creation / managemment as part of
first time start up
This commit is contained in:
Melanie
2010-03-22 18:49:56 +00:00
parent f020bd3206
commit 70b0e07d1e
7 changed files with 30 additions and 253 deletions

View File

@@ -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<string> names = new List<string>(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();
}
}