fix merge

httptests
UbitUmarov 2017-05-07 04:21:33 +01:00
commit 11f6d28a06
45 changed files with 908 additions and 484 deletions

View File

@ -787,7 +787,7 @@ namespace OpenSim.Groups
remoteClient.SendCreateGroupReply(groupID, true, "Group created successfully");
// Update the founder with new group information.
SendAgentGroupDataUpdate(remoteClient, false);
SendAgentGroupDataUpdate(remoteClient, true);
}
else
remoteClient.SendCreateGroupReply(groupID, false, reason);

View File

@ -115,9 +115,10 @@ namespace OpenSim.Groups
protected override byte[] ProcessRequest(string path, Stream requestData,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
StreamReader sr = new StreamReader(requestData);
string body = sr.ReadToEnd();
sr.Close();
string body;
using(StreamReader sr = new StreamReader(requestData))
body = sr.ReadToEnd();
body = body.Trim();
//m_log.DebugFormat("[XXX]: query String: {0}", body);

View File

@ -91,9 +91,10 @@ namespace OpenSim.Groups
protected override byte[] ProcessRequest(string path, Stream requestData,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
StreamReader sr = new StreamReader(requestData);
string body = sr.ReadToEnd();
sr.Close();
string body;
using(StreamReader sr = new StreamReader(requestData))
body = sr.ReadToEnd();
body = body.Trim();
//m_log.DebugFormat("[XXX]: query String: {0}", body);

View File

@ -362,8 +362,6 @@ namespace OpenSim.Capabilities.Handlers
{
// Taking our jpeg2000 data, decoding it, then saving it to a byte array with regular data
imgstream = new MemoryStream();
// Decode image to System.Drawing.Image
if (OpenJPEG.DecodeToImage(texture.Data, out managedImage, out image) && image != null)
{
@ -404,11 +402,8 @@ namespace OpenSim.Capabilities.Handlers
if(managedImage != null)
managedImage.Clear();
if (imgstream != null)
{
imgstream.Close();
imgstream.Dispose();
}
}
return data;
}

View File

@ -368,9 +368,6 @@ namespace OpenSim.Capabilities.Handlers
try
{
// Taking our jpeg2000 data, decoding it, then saving it to a byte array with regular data
imgstream = new MemoryStream();
// Decode image to System.Drawing.Image
if (OpenJPEG.DecodeToImage(texture.Data, out managedImage, out image) && image != null)
{
@ -412,11 +409,8 @@ namespace OpenSim.Capabilities.Handlers
managedImage.Clear();
if (imgstream != null)
{
imgstream.Close();
imgstream.Dispose();
}
}
return data;
}

View File

@ -75,6 +75,7 @@ namespace OpenSim.Data.MySQL
dbcon.Open();
Migration m = new Migration(dbcon, Assembly, "AssetStore");
m.Update();
dbcon.Close();
}
}
@ -144,6 +145,7 @@ namespace OpenSim.Data.MySQL
string.Format("[ASSETS DB]: MySql failure fetching asset {0}. Exception ", assetID), e);
}
}
dbcon.Close();
}
return asset;
@ -156,10 +158,6 @@ namespace OpenSim.Data.MySQL
/// <remarks>On failure : Throw an exception and attempt to reconnect to database</remarks>
override public bool StoreAsset(AssetBase asset)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
string assetName = asset.Name;
if (asset.Name.Length > AssetBase.MAX_ASSET_NAME)
{
@ -178,6 +176,9 @@ namespace OpenSim.Data.MySQL
asset.Description, asset.ID, asset.Description.Length, assetDescription.Length);
}
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (MySqlCommand cmd =
new MySqlCommand(
"replace INTO assets(id, name, description, assetType, local, temporary, create_time, access_time, asset_flags, CreatorID, data)" +
@ -200,12 +201,14 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags);
cmd.Parameters.AddWithValue("?data", asset.Data);
cmd.ExecuteNonQuery();
dbcon.Close();
return true;
}
catch (Exception e)
{
m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset {0} with name \"{1}\". Error: {2}",
asset.FullID, asset.Name, e.Message);
dbcon.Close();
return false;
}
}
@ -238,6 +241,7 @@ namespace OpenSim.Data.MySQL
e);
}
}
dbcon.Close();
}
}
@ -270,6 +274,7 @@ namespace OpenSim.Data.MySQL
}
}
}
dbcon.Close();
}
bool[] results = new bool[uuids.Length];
@ -334,6 +339,7 @@ namespace OpenSim.Data.MySQL
e);
}
}
dbcon.Close();
}
return retList;
@ -350,6 +356,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?id", id);
cmd.ExecuteNonQuery();
}
dbcon.Close();
}
return true;

View File

@ -59,6 +59,7 @@ namespace OpenSim.Data.MySQL
dbcon.Open();
Migration m = new Migration(dbcon, Assembly, "AuthStore");
m.Update();
dbcon.Close();
}
}
@ -76,8 +77,8 @@ namespace OpenSim.Data.MySQL
{
cmd.Parameters.AddWithValue("?principalID", principalID.ToString());
IDataReader result = cmd.ExecuteReader();
using(IDataReader result = cmd.ExecuteReader())
{
if(result.Read())
{
ret.PrincipalID = principalID;
@ -92,15 +93,18 @@ namespace OpenSim.Data.MySQL
ret.Data[s] = result[s].ToString();
}
dbcon.Close();
return ret;
}
else
{
dbcon.Close();
return null;
}
}
}
}
}
private void CheckColumnNames(IDataReader result)
{

View File

@ -82,6 +82,7 @@ namespace OpenSim.Data.MySQL
Migration m = new Migration(dbcon, Assembly, "EstateStore");
m.Update();
dbcon.Close();
Type t = typeof(EstateSettings);
m_Fields = t.GetFields(BindingFlags.NonPublic |
@ -143,7 +144,6 @@ namespace OpenSim.Data.MySQL
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
cmd.Connection = dbcon;
bool found = false;
@ -171,6 +171,8 @@ namespace OpenSim.Data.MySQL
}
}
}
dbcon.Close();
cmd.Connection = null;
if (!found && create)
{
@ -231,6 +233,7 @@ namespace OpenSim.Data.MySQL
es.Save();
}
dbcon.Close();
}
}
@ -263,6 +266,7 @@ namespace OpenSim.Data.MySQL
cmd.ExecuteNonQuery();
}
dbcon.Close();
}
SaveBanList(es);
@ -300,6 +304,7 @@ namespace OpenSim.Data.MySQL
}
}
}
dbcon.Close();
}
}
@ -329,6 +334,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.Clear();
}
}
dbcon.Close();
}
}
@ -358,6 +364,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.Clear();
}
}
dbcon.Close();
}
}
@ -383,6 +390,7 @@ namespace OpenSim.Data.MySQL
}
}
}
dbcon.Close();
}
return uuids.ToArray();
@ -437,7 +445,6 @@ namespace OpenSim.Data.MySQL
reader.Close();
}
}
dbcon.Close();
}
@ -466,7 +473,6 @@ namespace OpenSim.Data.MySQL
reader.Close();
}
}
dbcon.Close();
}

View File

@ -78,6 +78,7 @@ namespace OpenSim.Data.MySQL
conn.Open();
Migration m = new Migration(conn, Assembly, "FSAssetStore");
m.Update();
conn.Close();
}
}
catch (MySqlException e)
@ -121,9 +122,13 @@ namespace OpenSim.Data.MySQL
}
catch (MySqlException e)
{
cmd.Connection = null;
conn.Close();
m_log.ErrorFormat("[FSASSETS]: Query {0} failed with {1}", cmd.CommandText, e.ToString());
return false;
}
conn.Close();
cmd.Connection = null;
}
return true;
@ -175,7 +180,7 @@ namespace OpenSim.Data.MySQL
UpdateAccessTime(id, AccessTime);
}
}
conn.Close();
}
return meta;
@ -206,6 +211,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?id", AssetID);
cmd.ExecuteNonQuery();
}
conn.Close();
}
}
@ -299,6 +305,7 @@ namespace OpenSim.Data.MySQL
}
}
}
conn.Close();
}
for (int i = 0; i < uuids.Length; i++)
@ -333,6 +340,7 @@ namespace OpenSim.Data.MySQL
count = Convert.ToInt32(reader["count"]);
}
}
conn.Close();
}
return count;
@ -413,8 +421,8 @@ namespace OpenSim.Data.MySQL
imported++;
}
}
}
importConn.Close();
}
MainConsole.Instance.Output(String.Format("Import done, {0} assets imported", imported));

View File

@ -74,7 +74,9 @@ namespace OpenSim.Data.MySQL
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
return ExecuteNonQueryWithConnection(cmd, dbcon);
int ret = ExecuteNonQueryWithConnection(cmd, dbcon);
dbcon.Close();
return ret;
}
}
else
@ -97,12 +99,15 @@ namespace OpenSim.Data.MySQL
try
{
return cmd.ExecuteNonQuery();
int ret = cmd.ExecuteNonQuery();
cmd.Connection = null;
return ret;
}
catch (Exception e)
{
m_log.Error(e.Message, e);
m_log.Error(Environment.StackTrace.ToString());
cmd.Connection = null;
return 0;
}
}

View File

@ -160,8 +160,9 @@ namespace OpenSim.Data.MySQL
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
return DoQueryWithConnection(cmd, dbcon);
T[] ret = DoQueryWithConnection(cmd, dbcon);
dbcon.Close();
return ret;
}
}
else
@ -243,7 +244,7 @@ namespace OpenSim.Data.MySQL
result.Add(row);
}
}
cmd.Connection = null;
return result.ToArray();
}
@ -402,7 +403,10 @@ namespace OpenSim.Data.MySQL
dbcon.Open();
cmd.Connection = dbcon;
return cmd.ExecuteScalar();
Object ret = cmd.ExecuteScalar();
cmd.Connection = null;
dbcon.Close();
return ret;
}
}
else

View File

@ -78,6 +78,7 @@ namespace OpenSim.Data.MySQL
dbcon.Open();
Migration m = new Migration(dbcon, assem, "InventoryStore");
m.Update();
dbcon.Close();
}
}
@ -130,6 +131,7 @@ namespace OpenSim.Data.MySQL
items.Add(item);
}
dbcon.Close();
return items;
}
}
@ -170,6 +172,7 @@ namespace OpenSim.Data.MySQL
while (reader.Read())
items.Add(readInventoryFolder(reader));
dbcon.Close();
return items;
}
}
@ -221,6 +224,7 @@ namespace OpenSim.Data.MySQL
if (items.Count > 0)
rootFolder = items[0];
dbcon.Close();
return rootFolder;
}
}
@ -261,6 +265,7 @@ namespace OpenSim.Data.MySQL
while (reader.Read())
items.Add(readInventoryFolder(reader));
dbcon.Close();
return items;
}
}
@ -352,6 +357,7 @@ namespace OpenSim.Data.MySQL
if (reader.Read())
item = readInventoryItem(reader);
dbcon.Close();
return item;
}
}
@ -417,6 +423,7 @@ namespace OpenSim.Data.MySQL
if (reader.Read())
folder = readInventoryFolder(reader);
dbcon.Close();
return folder;
}
}
@ -504,6 +511,7 @@ namespace OpenSim.Data.MySQL
lock (m_dbLock)
result.ExecuteNonQuery();
}
dbcon.Close();
}
}
catch (MySqlException e)
@ -540,6 +548,7 @@ namespace OpenSim.Data.MySQL
lock (m_dbLock)
cmd.ExecuteNonQuery();
}
dbcon.Close();
}
}
catch (MySqlException e)
@ -600,6 +609,7 @@ namespace OpenSim.Data.MySQL
m_log.Error(e.ToString());
}
}
dbcon.Close();
}
}
@ -643,6 +653,7 @@ namespace OpenSim.Data.MySQL
m_log.Error(e.ToString());
}
}
dbcon.Close();
}
}
@ -806,6 +817,7 @@ namespace OpenSim.Data.MySQL
lock (m_dbLock)
cmd.ExecuteNonQuery();
}
dbcon.Close();
}
}
catch (MySqlException e)
@ -833,6 +845,7 @@ namespace OpenSim.Data.MySQL
lock (m_dbLock)
cmd.ExecuteNonQuery();
}
dbcon.Close();
}
}
catch (MySqlException e)
@ -886,6 +899,7 @@ namespace OpenSim.Data.MySQL
if (item != null)
list.Add(item);
}
dbcon.Close();
return list;
}
}

View File

@ -60,6 +60,7 @@ namespace OpenSim.Data.MySQL
dbcon.Open();
Migration m = new Migration(dbcon, Assembly, "GridStore");
m.Update();
dbcon.Close();
}
}
@ -260,6 +261,8 @@ namespace OpenSim.Data.MySQL
retList.Add(ret);
}
}
cmd.Connection = null;
dbcon.Close();
}
return retList;

View File

@ -88,6 +88,7 @@ namespace OpenSim.Data.MySQL
//
Migration m = new Migration(dbcon, Assembly, "RegionStore");
m.Update();
dbcon.Close();
}
}
@ -261,6 +262,7 @@ namespace OpenSim.Data.MySQL
ExecuteNonQuery(cmd);
}
}
dbcon.Close();
}
}
}
@ -300,6 +302,7 @@ namespace OpenSim.Data.MySQL
cmd.CommandText = "delete from prims where SceneGroupID= ?UUID";
ExecuteNonQuery(cmd);
}
dbcon.Close();
}
}
@ -334,6 +337,7 @@ namespace OpenSim.Data.MySQL
ExecuteNonQuery(cmd);
}
dbcon.Close();
}
}
}
@ -372,6 +376,7 @@ namespace OpenSim.Data.MySQL
ExecuteNonQuery(cmd);
}
dbcon.Close();
}
}
}
@ -411,6 +416,7 @@ namespace OpenSim.Data.MySQL
ExecuteNonQuery(cmd);
}
dbcon.Close();
}
}
}
@ -460,6 +466,7 @@ namespace OpenSim.Data.MySQL
}
}
}
dbcon.Close();
}
}
@ -535,6 +542,7 @@ namespace OpenSim.Data.MySQL
}
}
}
dbcon.Close();
}
}
@ -580,6 +588,7 @@ namespace OpenSim.Data.MySQL
}
}
}
dbcon.Close();
}
prim.Inventory.RestoreInventoryItems(inventory);
@ -634,6 +643,7 @@ namespace OpenSim.Data.MySQL
}
}
}
dbcon.Close();
}
}
});
@ -681,6 +691,7 @@ namespace OpenSim.Data.MySQL
}
}
}
dbcon.Close();
}
}
});
@ -727,6 +738,7 @@ namespace OpenSim.Data.MySQL
}
}
}
dbcon.Close();
}
}
@ -762,6 +774,7 @@ namespace OpenSim.Data.MySQL
}
}
}
dbcon.Close();
}
}
@ -783,6 +796,7 @@ namespace OpenSim.Data.MySQL
ExecuteNonQuery(cmd);
}
dbcon.Close();
}
}
}
@ -842,6 +856,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.Clear();
}
}
dbcon.Close();
}
}
}
@ -863,7 +878,8 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?regionID", regionUUID.ToString());
IDataReader result = ExecuteReader(cmd);
using(IDataReader result = ExecuteReader(cmd))
{
if(!result.Read())
{
//No result, so store our default windlight profile and return it
@ -940,6 +956,8 @@ namespace OpenSim.Data.MySQL
}
}
}
dbcon.Close();
}
return nWP;
}
@ -947,6 +965,7 @@ namespace OpenSim.Data.MySQL
public virtual RegionSettings LoadRegionSettings(UUID regionUUID)
{
RegionSettings rs = null;
bool needStore = false;
lock (m_dbLock)
{
@ -972,12 +991,16 @@ namespace OpenSim.Data.MySQL
rs.RegionUUID = regionUUID;
rs.OnSave += StoreRegionSettings;
needStore = true;
}
}
}
dbcon.Close();
}
}
if(needStore)
StoreRegionSettings(rs);
}
}
}
}
}
LoadSpawnPoints(rs);
@ -992,31 +1015,32 @@ namespace OpenSim.Data.MySQL
using (MySqlCommand cmd = dbcon.CreateCommand())
{
cmd.CommandText = "REPLACE INTO `regionwindlight` (`region_id`, `water_color_r`, `water_color_g`, ";
cmd.CommandText += "`water_color_b`, `water_fog_density_exponent`, `underwater_fog_modifier`, ";
cmd.CommandText += "`reflection_wavelet_scale_1`, `reflection_wavelet_scale_2`, `reflection_wavelet_scale_3`, ";
cmd.CommandText += "`fresnel_scale`, `fresnel_offset`, `refract_scale_above`, `refract_scale_below`, ";
cmd.CommandText += "`blur_multiplier`, `big_wave_direction_x`, `big_wave_direction_y`, `little_wave_direction_x`, ";
cmd.CommandText += "`little_wave_direction_y`, `normal_map_texture`, `horizon_r`, `horizon_g`, `horizon_b`, ";
cmd.CommandText += "`horizon_i`, `haze_horizon`, `blue_density_r`, `blue_density_g`, `blue_density_b`, ";
cmd.CommandText += "`blue_density_i`, `haze_density`, `density_multiplier`, `distance_multiplier`, `max_altitude`, ";
cmd.CommandText += "`sun_moon_color_r`, `sun_moon_color_g`, `sun_moon_color_b`, `sun_moon_color_i`, `sun_moon_position`, ";
cmd.CommandText += "`ambient_r`, `ambient_g`, `ambient_b`, `ambient_i`, `east_angle`, `sun_glow_focus`, `sun_glow_size`, ";
cmd.CommandText += "`scene_gamma`, `star_brightness`, `cloud_color_r`, `cloud_color_g`, `cloud_color_b`, `cloud_color_i`, ";
cmd.CommandText += "`cloud_x`, `cloud_y`, `cloud_density`, `cloud_coverage`, `cloud_scale`, `cloud_detail_x`, ";
cmd.CommandText += "`cloud_detail_y`, `cloud_detail_density`, `cloud_scroll_x`, `cloud_scroll_x_lock`, `cloud_scroll_y`, ";
cmd.CommandText += "`cloud_scroll_y_lock`, `draw_classic_clouds`) VALUES (?region_id, ?water_color_r, ";
cmd.CommandText += "?water_color_g, ?water_color_b, ?water_fog_density_exponent, ?underwater_fog_modifier, ?reflection_wavelet_scale_1, ";
cmd.CommandText += "?reflection_wavelet_scale_2, ?reflection_wavelet_scale_3, ?fresnel_scale, ?fresnel_offset, ?refract_scale_above, ";
cmd.CommandText += "?refract_scale_below, ?blur_multiplier, ?big_wave_direction_x, ?big_wave_direction_y, ?little_wave_direction_x, ";
cmd.CommandText += "?little_wave_direction_y, ?normal_map_texture, ?horizon_r, ?horizon_g, ?horizon_b, ?horizon_i, ?haze_horizon, ";
cmd.CommandText += "?blue_density_r, ?blue_density_g, ?blue_density_b, ?blue_density_i, ?haze_density, ?density_multiplier, ";
cmd.CommandText += "?distance_multiplier, ?max_altitude, ?sun_moon_color_r, ?sun_moon_color_g, ?sun_moon_color_b, ";
cmd.CommandText += "?sun_moon_color_i, ?sun_moon_position, ?ambient_r, ?ambient_g, ?ambient_b, ?ambient_i, ?east_angle, ";
cmd.CommandText += "?sun_glow_focus, ?sun_glow_size, ?scene_gamma, ?star_brightness, ?cloud_color_r, ?cloud_color_g, ";
cmd.CommandText += "?cloud_color_b, ?cloud_color_i, ?cloud_x, ?cloud_y, ?cloud_density, ?cloud_coverage, ?cloud_scale, ";
cmd.CommandText += "?cloud_detail_x, ?cloud_detail_y, ?cloud_detail_density, ?cloud_scroll_x, ?cloud_scroll_x_lock, ";
cmd.CommandText += "?cloud_scroll_y, ?cloud_scroll_y_lock, ?draw_classic_clouds)";
cmd.CommandText = "REPLACE INTO `regionwindlight` (`region_id`, `water_color_r`, `water_color_g`, "
+ "`water_color_b`, `water_fog_density_exponent`, `underwater_fog_modifier`, "
+ "`reflection_wavelet_scale_1`, `reflection_wavelet_scale_2`, `reflection_wavelet_scale_3`, "
+ "`fresnel_scale`, `fresnel_offset`, `refract_scale_above`, `refract_scale_below`, "
+ "`blur_multiplier`, `big_wave_direction_x`, `big_wave_direction_y`, `little_wave_direction_x`, "
+ "`little_wave_direction_y`, `normal_map_texture`, `horizon_r`, `horizon_g`, `horizon_b`, "
+ "`horizon_i`, `haze_horizon`, `blue_density_r`, `blue_density_g`, `blue_density_b`, "
+ "`blue_density_i`, `haze_density`, `density_multiplier`, `distance_multiplier`, `max_altitude`, "
+ "`sun_moon_color_r`, `sun_moon_color_g`, `sun_moon_color_b`, `sun_moon_color_i`, `sun_moon_position`, "
+ "`ambient_r`, `ambient_g`, `ambient_b`, `ambient_i`, `east_angle`, `sun_glow_focus`, `sun_glow_size`, "
+ "`scene_gamma`, `star_brightness`, `cloud_color_r`, `cloud_color_g`, `cloud_color_b`, `cloud_color_i`, "
+ "`cloud_x`, `cloud_y`, `cloud_density`, `cloud_coverage`, `cloud_scale`, `cloud_detail_x`, "
+ "`cloud_detail_y`, `cloud_detail_density`, `cloud_scroll_x`, `cloud_scroll_x_lock`, `cloud_scroll_y`, "
+ "`cloud_scroll_y_lock`, `draw_classic_clouds`) VALUES (?region_id, ?water_color_r, "
+ "?water_color_g, ?water_color_b, ?water_fog_density_exponent, ?underwater_fog_modifier, ?reflection_wavelet_scale_1, "
+ "?reflection_wavelet_scale_2, ?reflection_wavelet_scale_3, ?fresnel_scale, ?fresnel_offset, ?refract_scale_above, "
+ "?refract_scale_below, ?blur_multiplier, ?big_wave_direction_x, ?big_wave_direction_y, ?little_wave_direction_x, "
+ "?little_wave_direction_y, ?normal_map_texture, ?horizon_r, ?horizon_g, ?horizon_b, ?horizon_i, ?haze_horizon, "
+ "?blue_density_r, ?blue_density_g, ?blue_density_b, ?blue_density_i, ?haze_density, ?density_multiplier, "
+ "?distance_multiplier, ?max_altitude, ?sun_moon_color_r, ?sun_moon_color_g, ?sun_moon_color_b, "
+ "?sun_moon_color_i, ?sun_moon_position, ?ambient_r, ?ambient_g, ?ambient_b, ?ambient_i, ?east_angle, "
+ "?sun_glow_focus, ?sun_glow_size, ?scene_gamma, ?star_brightness, ?cloud_color_r, ?cloud_color_g, "
+ "?cloud_color_b, ?cloud_color_i, ?cloud_x, ?cloud_y, ?cloud_density, ?cloud_coverage, ?cloud_scale, "
+ "?cloud_detail_x, ?cloud_detail_y, ?cloud_detail_density, ?cloud_scroll_x, ?cloud_scroll_x_lock, "
+ "?cloud_scroll_y, ?cloud_scroll_y_lock, ?draw_classic_clouds)"
;
cmd.Parameters.AddWithValue("region_id", wl.regionID);
cmd.Parameters.AddWithValue("water_color_r", wl.waterColor.X);
@ -1084,6 +1108,7 @@ namespace OpenSim.Data.MySQL
ExecuteNonQuery(cmd);
}
dbcon.Close();
}
}
@ -1099,6 +1124,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?regionID", regionID.ToString());
ExecuteNonQuery(cmd);
}
dbcon.Close();
}
}
@ -1117,14 +1143,19 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString());
IDataReader result = ExecuteReader(cmd);
using(IDataReader result = ExecuteReader(cmd))
{
if(!result.Read())
{
dbcon.Close();
return String.Empty;
}
else
{
return Convert.ToString(result["llsd_settings"]);
string ret = Convert.ToString(result["llsd_settings"]);
dbcon.Close();
return ret;
}
}
}
}
@ -1145,6 +1176,7 @@ namespace OpenSim.Data.MySQL
ExecuteNonQuery(cmd);
}
dbcon.Close();
}
}
@ -1160,6 +1192,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString());
ExecuteNonQuery(cmd);
}
dbcon.Close();
}
}
#endregion
@ -1212,7 +1245,7 @@ namespace OpenSim.Data.MySQL
FillRegionSettingsCommand(cmd, rs);
ExecuteNonQuery(cmd);
}
dbcon.Close();
SaveSpawnPoints(rs);
}
}
@ -1259,6 +1292,7 @@ namespace OpenSim.Data.MySQL
}
}
}
dbcon.Close();
}
}
@ -2123,6 +2157,7 @@ namespace OpenSim.Data.MySQL
ExecuteNonQuery(cmd);
}
}
dbcon.Close();
}
}
}
@ -2152,6 +2187,7 @@ namespace OpenSim.Data.MySQL
}
}
}
dbcon.Close();
}
}
@ -2187,6 +2223,7 @@ namespace OpenSim.Data.MySQL
}
}
}
dbcon.Close();
}
}
}
@ -2221,6 +2258,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.Clear();
}
}
dbcon.Close();
}
}
}
@ -2240,6 +2278,7 @@ namespace OpenSim.Data.MySQL
cmd.ExecuteNonQuery();
}
dbcon.Close();
}
}
@ -2257,6 +2296,7 @@ namespace OpenSim.Data.MySQL
cmd.ExecuteNonQuery();
}
dbcon.Close();
}
}
@ -2280,6 +2320,7 @@ namespace OpenSim.Data.MySQL
}
}
}
dbcon.Close();
}
return ret;

View File

@ -69,6 +69,7 @@ namespace OpenSim.Data.MySQL
Migration m = new Migration(dbcon, Assembly, "UserProfiles");
m.Update();
dbcon.Close();
}
}
#endregion Member Functions
@ -89,7 +90,7 @@ namespace OpenSim.Data.MySQL
using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))
{
string query = "SELECT classifieduuid, name FROM classifieds WHERE creatoruuid = ?Id";
const string query = "SELECT classifieduuid, name FROM classifieds WHERE creatoruuid = ?Id";
dbcon.Open();
using (MySqlCommand cmd = new MySqlCommand(query, dbcon))
{
@ -121,58 +122,58 @@ namespace OpenSim.Data.MySQL
}
}
}
dbcon.Close();
}
return data;
}
public bool UpdateClassifiedRecord(UserClassifiedAdd ad, ref string result)
{
string query = string.Empty;
query += "INSERT INTO classifieds (";
query += "`classifieduuid`,";
query += "`creatoruuid`,";
query += "`creationdate`,";
query += "`expirationdate`,";
query += "`category`,";
query += "`name`,";
query += "`description`,";
query += "`parceluuid`,";
query += "`parentestate`,";
query += "`snapshotuuid`,";
query += "`simname`,";
query += "`posglobal`,";
query += "`parcelname`,";
query += "`classifiedflags`,";
query += "`priceforlisting`) ";
query += "VALUES (";
query += "?ClassifiedId,";
query += "?CreatorId,";
query += "?CreatedDate,";
query += "?ExpirationDate,";
query += "?Category,";
query += "?Name,";
query += "?Description,";
query += "?ParcelId,";
query += "?ParentEstate,";
query += "?SnapshotId,";
query += "?SimName,";
query += "?GlobalPos,";
query += "?ParcelName,";
query += "?Flags,";
query += "?ListingPrice ) ";
query += "ON DUPLICATE KEY UPDATE ";
query += "category=?Category, ";
query += "expirationdate=?ExpirationDate, ";
query += "name=?Name, ";
query += "description=?Description, ";
query += "parentestate=?ParentEstate, ";
query += "posglobal=?GlobalPos, ";
query += "parcelname=?ParcelName, ";
query += "classifiedflags=?Flags, ";
query += "priceforlisting=?ListingPrice, ";
query += "snapshotuuid=?SnapshotId";
const string query =
"INSERT INTO classifieds ("
+ "`classifieduuid`,"
+ "`creatoruuid`,"
+ "`creationdate`,"
+ "`expirationdate`,"
+ "`category`,"
+ "`name`,"
+ "`description`,"
+ "`parceluuid`,"
+ "`parentestate`,"
+ "`snapshotuuid`,"
+ "`simname`,"
+ "`posglobal`,"
+ "`parcelname`,"
+ "`classifiedflags`,"
+ "`priceforlisting`) "
+ "VALUES ("
+ "?ClassifiedId,"
+ "?CreatorId,"
+ "?CreatedDate,"
+ "?ExpirationDate,"
+ "?Category,"
+ "?Name,"
+ "?Description,"
+ "?ParcelId,"
+ "?ParentEstate,"
+ "?SnapshotId,"
+ "?SimName,"
+ "?GlobalPos,"
+ "?ParcelName,"
+ "?Flags,"
+ "?ListingPrice ) "
+ "ON DUPLICATE KEY UPDATE "
+ "category=?Category, "
+ "expirationdate=?ExpirationDate, "
+ "name=?Name, "
+ "description=?Description, "
+ "parentestate=?ParentEstate, "
+ "posglobal=?GlobalPos, "
+ "parcelname=?ParcelName, "
+ "classifiedflags=?Flags, "
+ "priceforlisting=?ListingPrice, "
+ "snapshotuuid=?SnapshotId"
;
if(string.IsNullOrEmpty(ad.ParcelName))
ad.ParcelName = "Unknown";
@ -228,6 +229,7 @@ namespace OpenSim.Data.MySQL
cmd.ExecuteNonQuery();
}
dbcon.Close();
}
}
catch (Exception e)
@ -242,10 +244,7 @@ namespace OpenSim.Data.MySQL
public bool DeleteClassifiedRecord(UUID recordId)
{
string query = string.Empty;
query += "DELETE FROM classifieds WHERE ";
query += "classifieduuid = ?recordId";
const string query = "DELETE FROM classifieds WHERE classifieduuid = ?recordId";
try
{
@ -258,6 +257,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?recordId", recordId.ToString());
cmd.ExecuteNonQuery();
}
dbcon.Close();
}
}
catch (Exception e)
@ -271,10 +271,8 @@ namespace OpenSim.Data.MySQL
public bool GetClassifiedInfo(ref UserClassifiedAdd ad, ref string result)
{
string query = string.Empty;
query += "SELECT * FROM classifieds WHERE ";
query += "classifieduuid = ?AdId";
const string query = "SELECT * FROM classifieds WHERE classifieduuid = ?AdId";
try
{
@ -322,10 +320,8 @@ namespace OpenSim.Data.MySQL
#region Picks Queries
public OSDArray GetAvatarPicks(UUID avatarId)
{
string query = string.Empty;
const string query = "SELECT `pickuuid`,`name` FROM userpicks WHERE creatoruuid = ?Id";
query += "SELECT `pickuuid`,`name` FROM userpicks WHERE ";
query += "creatoruuid = ?Id";
OSDArray data = new OSDArray();
try
@ -352,6 +348,7 @@ namespace OpenSim.Data.MySQL
}
}
}
dbcon.Close();
}
}
catch (Exception e)
@ -364,12 +361,8 @@ namespace OpenSim.Data.MySQL
public UserProfilePick GetPickInfo(UUID avatarId, UUID pickId)
{
string query = string.Empty;
UserProfilePick pick = new UserProfilePick();
query += "SELECT * FROM userpicks WHERE ";
query += "creatoruuid = ?CreatorId AND ";
query += "pickuuid = ?PickId";
const string query = "SELECT * FROM userpicks WHERE creatoruuid = ?CreatorId AND pickuuid = ?PickId";
try
{
@ -422,33 +415,33 @@ namespace OpenSim.Data.MySQL
public bool UpdatePicksRecord(UserProfilePick pick)
{
string query = string.Empty;
query += "INSERT INTO userpicks VALUES (";
query += "?PickId,";
query += "?CreatorId,";
query += "?TopPick,";
query += "?ParcelId,";
query += "?Name,";
query += "?Desc,";
query += "?SnapshotId,";
query += "?User,";
query += "?Original,";
query += "?SimName,";
query += "?GlobalPos,";
query += "?SortOrder,";
query += "?Enabled,";
query += "?Gatekeeper)";
query += "ON DUPLICATE KEY UPDATE ";
query += "parceluuid=?ParcelId,";
query += "name=?Name,";
query += "description=?Desc,";
query += "user=?User,";
query += "simname=?SimName,";
query += "snapshotuuid=?SnapshotId,";
query += "pickuuid=?PickId,";
query += "posglobal=?GlobalPos,";
query += "gatekeeper=?Gatekeeper";
const string query =
"INSERT INTO userpicks VALUES ("
+ "?PickId,"
+ "?CreatorId,"
+ "?TopPick,"
+ "?ParcelId,"
+ "?Name,"
+ "?Desc,"
+ "?SnapshotId,"
+ "?User,"
+ "?Original,"
+ "?SimName,"
+ "?GlobalPos,"
+ "?SortOrder,"
+ "?Enabled,"
+ "?Gatekeeper)"
+ "ON DUPLICATE KEY UPDATE "
+ "parceluuid=?ParcelId,"
+ "name=?Name,"
+ "description=?Desc,"
+ "user=?User,"
+ "simname=?SimName,"
+ "snapshotuuid=?SnapshotId,"
+ "pickuuid=?PickId,"
+ "posglobal=?GlobalPos,"
+ "gatekeeper=?Gatekeeper"
;
try
{
@ -474,6 +467,7 @@ namespace OpenSim.Data.MySQL
cmd.ExecuteNonQuery();
}
dbcon.Close();
}
}
catch (Exception e)
@ -487,10 +481,7 @@ namespace OpenSim.Data.MySQL
public bool DeletePicksRecord(UUID pickId)
{
string query = string.Empty;
query += "DELETE FROM userpicks WHERE ";
query += "pickuuid = ?PickId";
string query = "DELETE FROM userpicks WHERE pickuuid = ?PickId";
try
{
@ -504,6 +495,7 @@ namespace OpenSim.Data.MySQL
cmd.ExecuteNonQuery();
}
dbcon.Close();
}
}
catch (Exception e)
@ -519,11 +511,7 @@ namespace OpenSim.Data.MySQL
#region Avatar Notes Queries
public bool GetAvatarNotes(ref UserProfileNotes notes)
{ // WIP
string query = string.Empty;
query += "SELECT `notes` FROM usernotes WHERE ";
query += "useruuid = ?Id AND ";
query += "targetuuid = ?TargetId";
const string query = "SELECT `notes` FROM usernotes WHERE useruuid = ?Id AND targetuuid = ?TargetId";
try
{
@ -548,6 +536,7 @@ namespace OpenSim.Data.MySQL
}
}
}
dbcon.Close();
}
}
catch (Exception e)
@ -560,26 +549,25 @@ namespace OpenSim.Data.MySQL
public bool UpdateAvatarNotes(ref UserProfileNotes note, ref string result)
{
string query = string.Empty;
string query;
bool remove;
if(string.IsNullOrEmpty(note.Notes))
{
remove = true;
query += "DELETE FROM usernotes WHERE ";
query += "useruuid=?UserId AND ";
query += "targetuuid=?TargetId";
query = "DELETE FROM usernotes WHERE useruuid=?UserId AND targetuuid=?TargetId";
}
else
{
remove = false;
query += "INSERT INTO usernotes VALUES ( ";
query += "?UserId,";
query += "?TargetId,";
query += "?Notes )";
query += "ON DUPLICATE KEY ";
query += "UPDATE ";
query += "notes=?Notes";
query = "INSERT INTO usernotes VALUES ("
+ "?UserId,"
+ "?TargetId,"
+ "?Notes )"
+ "ON DUPLICATE KEY "
+ "UPDATE "
+ "notes=?Notes"
;
}
try
@ -596,6 +584,7 @@ namespace OpenSim.Data.MySQL
cmd.ExecuteNonQuery();
}
dbcon.Close();
}
}
catch (Exception e)
@ -612,10 +601,7 @@ namespace OpenSim.Data.MySQL
#region Avatar Properties
public bool GetAvatarProperties(ref UserProfileProperties props, ref string result)
{
string query = string.Empty;
query += "SELECT * FROM userprofile WHERE ";
query += "useruuid = ?Id";
string query = "SELECT * FROM userprofile WHERE useruuid = ?Id";
try
{
@ -664,35 +650,36 @@ namespace OpenSim.Data.MySQL
props.PublishProfile = false;
props.PublishMature = false;
query = "INSERT INTO userprofile (";
query += "useruuid, ";
query += "profilePartner, ";
query += "profileAllowPublish, ";
query += "profileMaturePublish, ";
query += "profileURL, ";
query += "profileWantToMask, ";
query += "profileWantToText, ";
query += "profileSkillsMask, ";
query += "profileSkillsText, ";
query += "profileLanguages, ";
query += "profileImage, ";
query += "profileAboutText, ";
query += "profileFirstImage, ";
query += "profileFirstText) VALUES (";
query += "?userId, ";
query += "?profilePartner, ";
query += "?profileAllowPublish, ";
query += "?profileMaturePublish, ";
query += "?profileURL, ";
query += "?profileWantToMask, ";
query += "?profileWantToText, ";
query += "?profileSkillsMask, ";
query += "?profileSkillsText, ";
query += "?profileLanguages, ";
query += "?profileImage, ";
query += "?profileAboutText, ";
query += "?profileFirstImage, ";
query += "?profileFirstText)";
query = "INSERT INTO userprofile ("
+ "useruuid, "
+ "profilePartner, "
+ "profileAllowPublish, "
+ "profileMaturePublish, "
+ "profileURL, "
+ "profileWantToMask, "
+ "profileWantToText, "
+ "profileSkillsMask, "
+ "profileSkillsText, "
+ "profileLanguages, "
+ "profileImage, "
+ "profileAboutText, "
+ "profileFirstImage, "
+ "profileFirstText) VALUES ("
+ "?userId, "
+ "?profilePartner, "
+ "?profileAllowPublish, "
+ "?profileMaturePublish, "
+ "?profileURL, "
+ "?profileWantToMask, "
+ "?profileWantToText, "
+ "?profileSkillsMask, "
+ "?profileSkillsText, "
+ "?profileLanguages, "
+ "?profileImage, "
+ "?profileAboutText, "
+ "?profileFirstImage, "
+ "?profileFirstText)"
;
dbcon.Close();
dbcon.Open();
@ -719,6 +706,7 @@ namespace OpenSim.Data.MySQL
}
}
}
dbcon.Close();
}
}
catch (Exception e)
@ -733,15 +721,10 @@ namespace OpenSim.Data.MySQL
public bool UpdateAvatarProperties(ref UserProfileProperties props, ref string result)
{
string query = string.Empty;
query += "UPDATE userprofile SET ";
query += "profileURL=?profileURL, ";
query += "profileImage=?image, ";
query += "profileAboutText=?abouttext,";
query += "profileFirstImage=?firstlifeimage,";
query += "profileFirstText=?firstlifetext ";
query += "WHERE useruuid=?uuid";
const string query = "UPDATE userprofile SET profileURL=?profileURL,"
+ "profileImage=?image, profileAboutText=?abouttext,"
+ "profileFirstImage=?firstlifeimage, profileFirstText=?firstlifetext "
+ "WHERE useruuid=?uuid";
try
{
@ -759,6 +742,7 @@ namespace OpenSim.Data.MySQL
cmd.ExecuteNonQuery();
}
dbcon.Close();
}
}
catch (Exception e)
@ -775,15 +759,13 @@ namespace OpenSim.Data.MySQL
#region Avatar Interests
public bool UpdateAvatarInterests(UserProfileProperties up, ref string result)
{
string query = string.Empty;
query += "UPDATE userprofile SET ";
query += "profileWantToMask=?WantMask, ";
query += "profileWantToText=?WantText,";
query += "profileSkillsMask=?SkillsMask,";
query += "profileSkillsText=?SkillsText, ";
query += "profileLanguages=?Languages ";
query += "WHERE useruuid=?uuid";
const string query = "UPDATE userprofile SET "
+ "profileWantToMask=?WantMask, "
+ "profileWantToText=?WantText,"
+ "profileSkillsMask=?SkillsMask,"
+ "profileSkillsText=?SkillsText, "
+ "profileLanguages=?Languages "
+ "WHERE useruuid=?uuid";
try
{
@ -817,18 +799,17 @@ namespace OpenSim.Data.MySQL
public OSDArray GetUserImageAssets(UUID avatarId)
{
OSDArray data = new OSDArray();
string query = "SELECT `snapshotuuid` FROM {0} WHERE `creatoruuid` = ?Id";
const string queryA = "SELECT `snapshotuuid` FROM {0} WHERE `creatoruuid` = ?Id";
// Get classified image assets
try
{
using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))
{
dbcon.Open();
using (MySqlCommand cmd = new MySqlCommand(string.Format (query,"`classifieds`"), dbcon))
using (MySqlCommand cmd = new MySqlCommand(string.Format (queryA,"`classifieds`"), dbcon))
{
cmd.Parameters.AddWithValue("?Id", avatarId.ToString());
@ -847,7 +828,7 @@ namespace OpenSim.Data.MySQL
dbcon.Close();
dbcon.Open();
using (MySqlCommand cmd = new MySqlCommand(string.Format (query,"`userpicks`"), dbcon))
using (MySqlCommand cmd = new MySqlCommand(string.Format (queryA,"`userpicks`"), dbcon))
{
cmd.Parameters.AddWithValue("?Id", avatarId.ToString());
@ -866,9 +847,9 @@ namespace OpenSim.Data.MySQL
dbcon.Close();
dbcon.Open();
query = "SELECT `profileImage`, `profileFirstImage` FROM `userprofile` WHERE `useruuid` = ?Id";
const string queryB = "SELECT `profileImage`, `profileFirstImage` FROM `userprofile` WHERE `useruuid` = ?Id";
using (MySqlCommand cmd = new MySqlCommand(string.Format (query,"`userpicks`"), dbcon))
using (MySqlCommand cmd = new MySqlCommand(string.Format (queryB,"`userpicks`"), dbcon))
{
cmd.Parameters.AddWithValue("?Id", avatarId.ToString());
@ -884,6 +865,7 @@ namespace OpenSim.Data.MySQL
}
}
}
dbcon.Close();
}
}
catch (Exception e)
@ -897,11 +879,7 @@ namespace OpenSim.Data.MySQL
#region User Preferences
public bool GetUserPreferences(ref UserPreferences pref, ref string result)
{
string query = string.Empty;
query += "SELECT imviaemail,visible,email FROM ";
query += "usersettings WHERE ";
query += "useruuid = ?Id";
const string query = "SELECT imviaemail,visible,email FROM usersettings WHERE useruuid = ?Id";
try
{
@ -925,10 +903,9 @@ namespace OpenSim.Data.MySQL
dbcon.Close();
dbcon.Open();
query = "INSERT INTO usersettings VALUES ";
query += "(?uuid,'false','false', ?Email)";
const string queryB = "INSERT INTO usersettings VALUES (?uuid,'false','false', ?Email)";
using (MySqlCommand put = new MySqlCommand(query, dbcon))
using (MySqlCommand put = new MySqlCommand(queryB, dbcon))
{
put.Parameters.AddWithValue("?Email", pref.EMail);
@ -939,6 +916,7 @@ namespace OpenSim.Data.MySQL
}
}
}
dbcon.Close();
}
}
catch (Exception e)
@ -953,13 +931,9 @@ namespace OpenSim.Data.MySQL
public bool UpdateUserPreferences(ref UserPreferences pref, ref string result)
{
string query = string.Empty;
query += "UPDATE usersettings SET ";
query += "imviaemail=?ImViaEmail, ";
query += "visible=?Visible, ";
query += "email=?EMail ";
query += "WHERE useruuid=?uuid";
const string query = "UPDATE usersettings SET imviaemail=?ImViaEmail,"
+ "visible=?Visible, email=?EMail "
+ "WHERE useruuid=?uuid";
try
{
@ -975,6 +949,7 @@ namespace OpenSim.Data.MySQL
cmd.ExecuteNonQuery();
}
dbcon.Close();
}
}
catch (Exception e)
@ -991,11 +966,7 @@ namespace OpenSim.Data.MySQL
#region Integration
public bool GetUserAppData(ref UserAppData props, ref string result)
{
string query = string.Empty;
query += "SELECT * FROM `userdata` WHERE ";
query += "UserId = ?Id AND ";
query += "TagId = ?TagId";
const string query = "SELECT * FROM `userdata` WHERE UserId = ?Id AND TagId = ?TagId";
try
{
@ -1017,13 +988,8 @@ namespace OpenSim.Data.MySQL
}
else
{
query += "INSERT INTO userdata VALUES ( ";
query += "?UserId,";
query += "?TagId,";
query += "?DataKey,";
query += "?DataVal) ";
using (MySqlCommand put = new MySqlCommand(query, dbcon))
const string queryB = "INSERT INTO userdata VALUES (?UserId, ?TagId, ?DataKey, ?DataVal)";
using (MySqlCommand put = new MySqlCommand(queryB, dbcon))
{
put.Parameters.AddWithValue("?UserId", props.UserId.ToString());
put.Parameters.AddWithValue("?TagId", props.TagId.ToString());
@ -1035,6 +1001,7 @@ namespace OpenSim.Data.MySQL
}
}
}
dbcon.Close();
}
}
catch (Exception e)
@ -1049,14 +1016,7 @@ namespace OpenSim.Data.MySQL
public bool SetUserAppData(UserAppData props, ref string result)
{
string query = string.Empty;
query += "UPDATE userdata SET ";
query += "TagId = ?TagId, ";
query += "DataKey = ?DataKey, ";
query += "DataVal = ?DataVal WHERE ";
query += "UserId = ?UserId AND ";
query += "TagId = ?TagId";
const string query = "UPDATE userdata SET TagId = ?TagId, DataKey = ?DataKey, DataVal = ?DataVal WHERE UserId = ?UserId AND TagId = ?TagId";
try
{
@ -1072,6 +1032,7 @@ namespace OpenSim.Data.MySQL
cmd.ExecuteNonQuery();
}
dbcon.Close();
}
}
catch (Exception e)

View File

@ -97,6 +97,7 @@ namespace OpenSim.Data.MySQL
dbcon.Open();
Migration m = new Migration(dbcon, Assembly, "XAssetStore");
m.Update();
dbcon.Close();
}
}
@ -130,6 +131,7 @@ namespace OpenSim.Data.MySQL
// m_log.DebugFormat("[MYSQL XASSET DATA]: Looking for asset {0}", assetID);
AssetBase asset = null;
int accessTime = 0;
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
@ -140,7 +142,6 @@ namespace OpenSim.Data.MySQL
dbcon))
{
cmd.Parameters.AddWithValue("?ID", assetID.ToString());
try
{
using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow))
@ -159,23 +160,7 @@ namespace OpenSim.Data.MySQL
asset.Temporary = Convert.ToBoolean(dbReader["Temporary"]);
asset.Flags = (AssetFlags)Convert.ToInt32(dbReader["AssetFlags"]);
if (m_enableCompression)
{
using (GZipStream decompressionStream = new GZipStream(new MemoryStream(asset.Data), CompressionMode.Decompress))
{
MemoryStream outputStream = new MemoryStream();
WebUtil.CopyStream(decompressionStream, outputStream, int.MaxValue);
// int compressedLength = asset.Data.Length;
asset.Data = outputStream.ToArray();
// m_log.DebugFormat(
// "[XASSET DB]: Decompressed {0} {1} to {2} bytes from {3}",
// asset.ID, asset.Name, asset.Data.Length, compressedLength);
}
}
UpdateAccessTime(asset.Metadata, (int)dbReader["AccessTime"]);
accessTime = (int)dbReader["AccessTime"];
}
}
}
@ -184,8 +169,37 @@ namespace OpenSim.Data.MySQL
m_log.Error(string.Format("[MYSQL XASSET DATA]: Failure fetching asset {0}", assetID), e);
}
}
dbcon.Close();
}
if(asset == null)
return asset;
if(accessTime > 0)
{
try
{
UpdateAccessTime(asset.Metadata, accessTime);
}
catch { }
}
if (m_enableCompression && asset.Data != null)
{
using(MemoryStream ms = new MemoryStream(asset.Data))
using(GZipStream decompressionStream = new GZipStream(ms, CompressionMode.Decompress))
{
using(MemoryStream outputStream = new MemoryStream())
{
decompressionStream.CopyTo(outputStream, int.MaxValue);
// int compressedLength = asset.Data.Length;
asset.Data = outputStream.ToArray();
}
// m_log.DebugFormat(
// "[XASSET DB]: Decompressed {0} {1} to {2} bytes from {3}",
// asset.ID, asset.Name, asset.Data.Length, compressedLength);
}
}
return asset;
}
@ -303,6 +317,7 @@ namespace OpenSim.Data.MySQL
transaction.Commit();
}
dbcon.Close();
}
}
@ -344,6 +359,7 @@ namespace OpenSim.Data.MySQL
"[XASSET MYSQL DB]: Failure updating access_time for asset {0} with name {1}",
assetMetadata.ID, assetMetadata.Name);
}
dbcon.Close();
}
}
@ -474,6 +490,7 @@ namespace OpenSim.Data.MySQL
m_log.Error("[XASSETS DB]: MySql failure fetching asset set" + Environment.NewLine + e.ToString());
}
}
dbcon.Close();
}
return retList;
@ -492,9 +509,9 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?ID", id);
cmd.ExecuteNonQuery();
}
// TODO: How do we deal with data from deleted assets? Probably not easily reapable unless we
// keep a reference count (?)
dbcon.Close();
}
return true;

View File

@ -328,7 +328,6 @@ namespace OpenSim.Data.MySQL
{
return false;
}
cmd.Dispose();
}
dbcon.Close();

View File

@ -18,7 +18,7 @@ CREATE TABLE `os_groups_groups` (
PRIMARY KEY (`GroupID`),
UNIQUE KEY `Name` (`Name`),
FULLTEXT KEY `Name_2` (`Name`)
) ENGINE=InnoDB;
) ENGINE=MyISAM;
CREATE TABLE `os_groups_membership` (

View File

@ -173,13 +173,15 @@ namespace OpenSim.Data.PGSQL
if (m_enableCompression)
{
using (GZipStream decompressionStream = new GZipStream(new MemoryStream(asset.Data), CompressionMode.Decompress))
using(MemoryStream ms = new MemoryStream(asset.Data))
using(GZipStream decompressionStream = new GZipStream(ms, CompressionMode.Decompress))
{
MemoryStream outputStream = new MemoryStream();
WebUtil.CopyStream(decompressionStream, outputStream, int.MaxValue);
using(MemoryStream outputStream = new MemoryStream())
{
decompressionStream.CopyTo(outputStream,int.MaxValue);
// int compressedLength = asset.Data.Length;
asset.Data = outputStream.ToArray();
}
// m_log.DebugFormat(
// "[XASSET DB]: Decompressed {0} {1} to {2} bytes from {3}",
// asset.ID, asset.Name, asset.Data.Length, compressedLength);

View File

@ -529,7 +529,7 @@ namespace OpenSim.Framework.Servers.HttpServer
if (psEvArgs.Request != null)
{
OSHttpRequest req = new OSHttpRequest(context, request);
string requestBody = String.Empty;
string requestBody;
Encoding encoding = Encoding.UTF8;
using(StreamReader reader = new StreamReader(req.InputStream, encoding))
requestBody = reader.ReadToEnd();
@ -695,7 +695,8 @@ namespace OpenSim.Framework.Servers.HttpServer
{
//m_log.Debug("[BASE HTTP SERVER]: Found Caps based HTTP Handler");
IGenericHTTPHandler HTTPRequestHandler = requestHandler as IGenericHTTPHandler;
string requestBody = String.Empty;
string requestBody;
Encoding encoding = Encoding.UTF8;
using(StreamReader reader = new StreamReader(request.InputStream, encoding))
requestBody = reader.ReadToEnd();
@ -814,6 +815,8 @@ namespace OpenSim.Framework.Servers.HttpServer
}
}
request.InputStream.Dispose();
if (buffer != null)
{
if (WebUtil.DebugLevel >= 5)
@ -1119,7 +1122,7 @@ namespace OpenSim.Framework.Servers.HttpServer
{
String requestBody;
Stream requestStream = request.InputStream;
Stream requestStream = Util.Copy(request.InputStream);
Stream innerStream = null;
try
{
@ -1130,9 +1133,8 @@ namespace OpenSim.Framework.Servers.HttpServer
}
using (StreamReader reader = new StreamReader(requestStream, Encoding.UTF8))
{
requestBody = reader.ReadToEnd();
}
}
finally
{
@ -1396,14 +1398,11 @@ namespace OpenSim.Framework.Servers.HttpServer
//m_log.Warn("[BASE HTTP SERVER]: We've figured out it's a LLSD Request");
Stream requestStream = request.InputStream;
string requestBody = string.Empty;
string requestBody;
Encoding encoding = Encoding.UTF8;
using(StreamReader reader = new StreamReader(requestStream, encoding))
requestBody= reader.ReadToEnd();
if(requestStream.CanRead)
requestStream.Close();
//m_log.DebugFormat("[OGP]: {0}:{1}", request.RawUrl, requestBody);
OSD llsdRequest = null;
@ -1725,12 +1724,10 @@ namespace OpenSim.Framework.Servers.HttpServer
byte[] buffer;
Stream requestStream = request.InputStream;
string requestBody = string.Empty;
string requestBody;
Encoding encoding = Encoding.UTF8;
using(StreamReader reader = new StreamReader(requestStream, encoding))
requestBody = reader.ReadToEnd();
if(requestStream.CanRead)
requestStream.Close();
Hashtable keysvals = new Hashtable();
Hashtable headervals = new Hashtable();
@ -2269,7 +2266,7 @@ namespace OpenSim.Framework.Servers.HttpServer
string file = Path.Combine(".", "http_500.html");
if (!File.Exists(file))
return getDefaultHTTP500();
string result = string.Empty;
string result;
using(StreamReader sr = File.OpenText(file))
result = sr.ReadToEnd();
return result;

View File

@ -50,11 +50,10 @@ namespace OpenSim.Framework.Servers.HttpServer
protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
string requestBody;
Encoding encoding = Encoding.UTF8;
StreamReader streamReader = new StreamReader(request, encoding);
string requestBody = streamReader.ReadToEnd();
streamReader.Close();
using(StreamReader streamReader = new StreamReader(request,encoding))
requestBody = streamReader.ReadToEnd();
string param = GetParam(path);
string responseString = m_restMethod(requestBody, path, param, httpRequest, httpResponse);

View File

@ -185,8 +185,9 @@ namespace OpenSim.Region.ClientStack.Linden
protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
StreamReader reader = new StreamReader(request);
string message = reader.ReadToEnd();
string message;
using(StreamReader reader = new StreamReader(request))
message = reader.ReadToEnd();
OSD osd = OSDParser.DeserializeLLSDXml(message);

View File

@ -216,6 +216,8 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures
rc.Request(reqStream, m_Auth);
m_log.DebugFormat("[XBakes]: stored {0} textures for user {1}", numberWears, agentId);
}
if(reqStream != null)
reqStream.Dispose();
}, null, "XBakesModule.Store"
);
}

View File

@ -65,9 +65,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
protected override byte[] ProcessRequest(
string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
StreamReader sr = new StreamReader(requestData);
string body = sr.ReadToEnd();
sr.Close();
string body;
using(StreamReader sr = new StreamReader(requestData))
body = sr.ReadToEnd();
body = body.Trim();
//m_log.DebugFormat("[XXX]: query String: {0}", body);

View File

@ -119,7 +119,15 @@ namespace OpenSim.Region.CoreModules.Framework
if(!client.IsActive)
return;
GridRegion r = m_scenes[0].GridService.GetRegionByUUID(UUID.Zero, regionID);
if(m_scenes.Count == 0)
return;
Scene baseScene = m_scenes[0];
if(baseScene == null || baseScene.ShuttingDown)
return;
GridRegion r = baseScene.GridService.GetRegionByUUID(UUID.Zero, regionID);
if(!client.IsActive)
return;

View File

@ -60,9 +60,10 @@ namespace OpenSim.Region.CoreModules.World.Estate
protected override byte[] ProcessRequest(string path, Stream requestData,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
StreamReader sr = new StreamReader(requestData);
string body = sr.ReadToEnd();
sr.Close();
string body;
using(StreamReader sr = new StreamReader(requestData))
body = sr.ReadToEnd();
body = body.Trim();
// m_log.DebugFormat("[XESTATE HANDLER]: query String: {0}", body);

View File

@ -460,9 +460,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge
if (resp.ContentLength > 0)
{
StreamReader content = new StreamReader(resp.GetResponseStream());
using(StreamReader content = new StreamReader(resp.GetResponseStream()))
m_log.ErrorFormat("[Concierge] response from {0} content: {1}", bs.Uri, content.ReadToEnd());
content.Close();
}
}
}

View File

@ -901,7 +901,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
remoteClient.SendCreateGroupReply(groupID, true, "Group created successfully");
// Update the founder with new group information.
SendAgentGroupDataUpdate(remoteClient, false);
SendAgentGroupDataUpdate(remoteClient, true);
return groupID;
}
@ -1520,6 +1520,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
lastname, activeGroupPowers, activeGroupName,
activeGroupTitle);
if (tellOthers)
SendScenePresenceUpdate(agentID, activeGroupTitle);

View File

@ -82,11 +82,11 @@ namespace OpenSim.Server.Handlers.Authentication
switch (p[0])
{
case "plain":
StreamReader sr = new StreamReader(request);
string body = sr.ReadToEnd();
sr.Close();
string body;
using(StreamReader sr = new StreamReader(request))
body = sr.ReadToEnd();
return DoPlainMethods(body);
case "crypt":
byte[] buffer = new byte[request.Length];
long length = request.Length;

View File

@ -222,7 +222,10 @@ For more information, see <a href='http://openid.net/'>http://openid.net/</a>.
try
{
NameValueCollection postQuery = HttpUtility.ParseQueryString(new StreamReader(httpRequest.InputStream).ReadToEnd());
string forPost;
using(StreamReader sr = new StreamReader(httpRequest.InputStream))
forPost = sr.ReadToEnd();
NameValueCollection postQuery = HttpUtility.ParseQueryString(forPost);
NameValueCollection getQuery = HttpUtility.ParseQueryString(httpRequest.Url.Query);
NameValueCollection openIdQuery = (postQuery.GetValues("openid.mode") != null ? postQuery : getQuery);

View File

@ -60,9 +60,9 @@ namespace OpenSim.Server.Handlers.Avatar
protected override byte[] ProcessRequest(string path, Stream requestData,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
StreamReader sr = new StreamReader(requestData);
string body = sr.ReadToEnd();
sr.Close();
string body;
using(StreamReader sr = new StreamReader(requestData))
body = sr.ReadToEnd();
body = body.Trim();
//m_log.DebugFormat("[XXX]: query String: {0}", body);

View File

@ -65,10 +65,8 @@ namespace OpenSim.Server.Handlers.BakedTextures
return new byte[0];
}
StreamReader sr = new StreamReader(request);
using(StreamReader sr = new StreamReader(request))
m_BakesService.Store(p[0],sr.ReadToEnd());
sr.Close();
return new byte[0];
}

View File

@ -282,9 +282,10 @@ namespace OpenSim.Server.Handlers
// /estates/estate/?eid=int&region=uuid
if ("estate".Equals(resource))
{
StreamReader sr = new StreamReader(request);
string body = sr.ReadToEnd();
sr.Close();
string body;
using(StreamReader sr = new StreamReader(request))
body = sr.ReadToEnd();
body = body.Trim();
Dictionary<string, object> requestData = ServerUtils.ParseQueryString(body);

View File

@ -61,9 +61,9 @@ namespace OpenSim.Server.Handlers.Friends
protected override byte[] ProcessRequest(string path, Stream requestData,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
StreamReader sr = new StreamReader(requestData);
string body = sr.ReadToEnd();
sr.Close();
string body;
using(StreamReader sr = new StreamReader(requestData))
body = sr.ReadToEnd();
body = body.Trim();
//m_log.DebugFormat("[XXX]: query String: {0}", body);

View File

@ -65,9 +65,9 @@ namespace OpenSim.Server.Handlers.Grid
protected override byte[] ProcessRequest(string path, Stream requestData,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
StreamReader sr = new StreamReader(requestData);
string body = sr.ReadToEnd();
sr.Close();
string body;
using(StreamReader sr = new StreamReader(requestData))
body = sr.ReadToEnd();
body = body.Trim();
//m_log.DebugFormat("[XXX]: query String: {0}", body);

View File

@ -60,9 +60,9 @@ namespace OpenSim.Server.Handlers.GridUser
protected override byte[] ProcessRequest(string path, Stream requestData,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
StreamReader sr = new StreamReader(requestData);
string body = sr.ReadToEnd();
sr.Close();
string body;
using(StreamReader sr = new StreamReader(requestData))
body = sr.ReadToEnd();
body = body.Trim();
//m_log.DebugFormat("[XXX]: query String: {0}", body);

View File

@ -71,9 +71,9 @@ namespace OpenSim.Server.Handlers.Hypergrid
protected override byte[] ProcessRequest(string path, Stream requestData,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
StreamReader sr = new StreamReader(requestData);
string body = sr.ReadToEnd();
sr.Close();
string body;
using(StreamReader sr = new StreamReader(requestData))
body = sr.ReadToEnd();
body = body.Trim();
//m_log.DebugFormat("[XXX]: query String: {0}", body);

View File

@ -95,9 +95,9 @@ namespace OpenSim.Server.Handlers.Inventory
protected override byte[] ProcessRequest(string path, Stream requestData,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
StreamReader sr = new StreamReader(requestData);
string body = sr.ReadToEnd();
sr.Close();
string body;
using(StreamReader sr = new StreamReader(requestData))
body = sr.ReadToEnd();
body = body.Trim();
//m_log.DebugFormat("[XXX]: query String: {0}", body);

View File

@ -104,9 +104,9 @@ namespace OpenSim.Server.Handlers.MapImage
protected override byte[] ProcessRequest(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
// m_log.DebugFormat("[MAP SERVICE IMAGE HANDLER]: Received {0}", path);
StreamReader sr = new StreamReader(requestData);
string body = sr.ReadToEnd();
sr.Close();
string body;
using(StreamReader sr = new StreamReader(requestData))
body = sr.ReadToEnd();
body = body.Trim();
try

View File

@ -102,9 +102,9 @@ namespace OpenSim.Server.Handlers.MapImage
public override byte[] Handle(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
// m_log.DebugFormat("[MAP SERVICE IMAGE HANDLER]: Received {0}", path);
StreamReader sr = new StreamReader(requestData);
string body = sr.ReadToEnd();
sr.Close();
string body;
using(StreamReader sr = new StreamReader(requestData))
body = sr.ReadToEnd();
body = body.Trim();
try
@ -215,14 +215,17 @@ namespace OpenSim.Server.Handlers.MapImage
private byte[] DocToBytes(XmlDocument doc)
{
MemoryStream ms = new MemoryStream();
XmlTextWriter xw = new XmlTextWriter(ms, null);
using(MemoryStream ms = new MemoryStream())
{
using(XmlTextWriter xw = new XmlTextWriter(ms,null))
{
xw.Formatting = Formatting.Indented;
doc.WriteTo(xw);
xw.Flush();
}
return ms.ToArray();
}
}
private System.Net.IPAddress GetCallerIP(IOSHttpRequest request)
{

View File

@ -72,9 +72,9 @@ namespace OpenSim.Server.Handlers.UserAccounts
protected override byte[] ProcessRequest(string path, Stream requestData,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
StreamReader sr = new StreamReader(requestData);
string body = sr.ReadToEnd();
sr.Close();
string body;
using(StreamReader sr = new StreamReader(requestData))
body = sr.ReadToEnd();
body = body.Trim();
// We need to check the authorization header

View File

@ -183,8 +183,8 @@ namespace OpenSim.Services.Connectors
{
using (StreamReader sr = new StreamReader(s))
{
sr.ReadToEnd(); // just try to read
//reply = sr.ReadToEnd().Trim();
sr.ReadToEnd().Trim();
//m_log.InfoFormat("[REST COMMS]: DoHelloNeighbourCall reply was {0} ", reply);
}
}

View File

@ -0,0 +1,339 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenMetaverse;
using OpenSim.Data;
namespace OpenSim.Tests.Common.Mock
{
public class TestGroupsDataPlugin : IGroupsData
{
class CompositeKey
{
private readonly string _key;
public string Key
{
get { return _key; }
}
public CompositeKey(UUID _k1, string _k2)
{
_key = _k1.ToString() + _k2;
}
public CompositeKey(UUID _k1, string _k2, string _k3)
{
_key = _k1.ToString() + _k2 + _k3;
}
public override bool Equals(object obj)
{
if (obj is CompositeKey)
{
return Key == ((CompositeKey)obj).Key;
}
return false;
}
public override int GetHashCode()
{
return base.GetHashCode();
}
public override string ToString()
{
return Key;
}
}
private Dictionary<UUID, GroupData> m_Groups;
private Dictionary<CompositeKey, MembershipData> m_Membership;
private Dictionary<CompositeKey, RoleData> m_Roles;
private Dictionary<CompositeKey, RoleMembershipData> m_RoleMembership;
private Dictionary<UUID, InvitationData> m_Invites;
private Dictionary<UUID, NoticeData> m_Notices;
private Dictionary<string, PrincipalData> m_Principals;
public TestGroupsDataPlugin(string connectionString, string realm)
{
m_Groups = new Dictionary<UUID, GroupData>();
m_Membership = new Dictionary<CompositeKey, MembershipData>();
m_Roles = new Dictionary<CompositeKey, RoleData>();
m_RoleMembership = new Dictionary<CompositeKey, RoleMembershipData>();
m_Invites = new Dictionary<UUID, InvitationData>();
m_Notices = new Dictionary<UUID, NoticeData>();
m_Principals = new Dictionary<string, PrincipalData>();
}
#region groups table
public bool StoreGroup(GroupData data)
{
return false;
}
public GroupData RetrieveGroup(UUID groupID)
{
if (m_Groups.ContainsKey(groupID))
return m_Groups[groupID];
return null;
}
public GroupData RetrieveGroup(string name)
{
return m_Groups.Values.First(g => g.Data.ContainsKey("Name") && g.Data["Name"] == name);
}
public GroupData[] RetrieveGroups(string pattern)
{
if (string.IsNullOrEmpty(pattern))
pattern = "1";
IEnumerable<GroupData> groups = m_Groups.Values.Where(g => g.Data.ContainsKey("Name") && (g.Data["Name"].StartsWith(pattern) || g.Data["Name"].EndsWith(pattern)));
return (groups != null) ? groups.ToArray() : new GroupData[0];
}
public bool DeleteGroup(UUID groupID)
{
return m_Groups.Remove(groupID);
}
public int GroupsCount()
{
return m_Groups.Count;
}
#endregion
#region membership table
public MembershipData RetrieveMember(UUID groupID, string pricipalID)
{
CompositeKey dkey = new CompositeKey(groupID, pricipalID);
if (m_Membership.ContainsKey(dkey))
return m_Membership[dkey];
return null;
}
public MembershipData[] RetrieveMembers(UUID groupID)
{
IEnumerable<CompositeKey> keys = m_Membership.Keys.Where(k => k.Key.StartsWith(groupID.ToString()));
return keys.Where(m_Membership.ContainsKey).Select(x => m_Membership[x]).ToArray();
}
public MembershipData[] RetrieveMemberships(string principalID)
{
IEnumerable<CompositeKey> keys = m_Membership.Keys.Where(k => k.Key.EndsWith(principalID.ToString()));
return keys.Where(m_Membership.ContainsKey).Select(x => m_Membership[x]).ToArray();
}
public MembershipData[] RetrievePrincipalGroupMemberships(string principalID)
{
return RetrieveMemberships(principalID);
}
public MembershipData RetrievePrincipalGroupMembership(string principalID, UUID groupID)
{
CompositeKey dkey = new CompositeKey(groupID, principalID);
if (m_Membership.ContainsKey(dkey))
return m_Membership[dkey];
return null;
}
public bool StoreMember(MembershipData data)
{
CompositeKey dkey = new CompositeKey(data.GroupID, data.PrincipalID);
m_Membership[dkey] = data;
return true;
}
public bool DeleteMember(UUID groupID, string principalID)
{
CompositeKey dkey = new CompositeKey(groupID, principalID);
if (m_Membership.ContainsKey(dkey))
return m_Membership.Remove(dkey);
return false;
}
public int MemberCount(UUID groupID)
{
return m_Membership.Count;
}
#endregion
#region roles table
public bool StoreRole(RoleData data)
{
CompositeKey dkey = new CompositeKey(data.GroupID, data.RoleID.ToString());
m_Roles[dkey] = data;
return true;
}
public RoleData RetrieveRole(UUID groupID, UUID roleID)
{
CompositeKey dkey = new CompositeKey(groupID, roleID.ToString());
if (m_Roles.ContainsKey(dkey))
return m_Roles[dkey];
return null;
}
public RoleData[] RetrieveRoles(UUID groupID)
{
IEnumerable<CompositeKey> keys = m_Roles.Keys.Where(k => k.Key.StartsWith(groupID.ToString()));
return keys.Where(m_Roles.ContainsKey).Select(x => m_Roles[x]).ToArray();
}
public bool DeleteRole(UUID groupID, UUID roleID)
{
CompositeKey dkey = new CompositeKey(groupID, roleID.ToString());
if (m_Roles.ContainsKey(dkey))
return m_Roles.Remove(dkey);
return false;
}
public int RoleCount(UUID groupID)
{
return m_Roles.Count;
}
#endregion
#region rolememberhip table
public RoleMembershipData[] RetrieveRolesMembers(UUID groupID)
{
IEnumerable<CompositeKey> keys = m_Roles.Keys.Where(k => k.Key.StartsWith(groupID.ToString()));
return keys.Where(m_RoleMembership.ContainsKey).Select(x => m_RoleMembership[x]).ToArray();
}
public RoleMembershipData[] RetrieveRoleMembers(UUID groupID, UUID roleID)
{
IEnumerable<CompositeKey> keys = m_Roles.Keys.Where(k => k.Key.StartsWith(groupID.ToString() + roleID.ToString()));
return keys.Where(m_RoleMembership.ContainsKey).Select(x => m_RoleMembership[x]).ToArray();
}
public RoleMembershipData[] RetrieveMemberRoles(UUID groupID, string principalID)
{
IEnumerable<CompositeKey> keys = m_Roles.Keys.Where(k => k.Key.StartsWith(groupID.ToString()) && k.Key.EndsWith(principalID));
return keys.Where(m_RoleMembership.ContainsKey).Select(x => m_RoleMembership[x]).ToArray();
}
public RoleMembershipData RetrieveRoleMember(UUID groupID, UUID roleID, string principalID)
{
CompositeKey dkey = new CompositeKey(groupID, roleID.ToString(), principalID);
if (m_RoleMembership.ContainsKey(dkey))
return m_RoleMembership[dkey];
return null;
}
public int RoleMemberCount(UUID groupID, UUID roleID)
{
return m_RoleMembership.Count;
}
public bool StoreRoleMember(RoleMembershipData data)
{
CompositeKey dkey = new CompositeKey(data.GroupID, data.RoleID.ToString(), data.PrincipalID);
m_RoleMembership[dkey] = data;
return true;
}
public bool DeleteRoleMember(RoleMembershipData data)
{
CompositeKey dkey = new CompositeKey(data.GroupID, data.RoleID.ToString(), data.PrincipalID);
if (m_RoleMembership.ContainsKey(dkey))
return m_RoleMembership.Remove(dkey);
return false;
}
public bool DeleteMemberAllRoles(UUID groupID, string principalID)
{
List<CompositeKey> keys = m_RoleMembership.Keys.Where(k => k.Key.StartsWith(groupID.ToString()) && k.Key.EndsWith(principalID)).ToList();
foreach (CompositeKey k in keys)
m_RoleMembership.Remove(k);
return true;
}
#endregion
#region principals table
public bool StorePrincipal(PrincipalData data)
{
m_Principals[data.PrincipalID] = data;
return true;
}
public PrincipalData RetrievePrincipal(string principalID)
{
if (m_Principals.ContainsKey(principalID))
return m_Principals[principalID];
return null;
}
public bool DeletePrincipal(string principalID)
{
if (m_Principals.ContainsKey(principalID))
return m_Principals.Remove(principalID);
return false;
}
#endregion
#region invites table
public bool StoreInvitation(InvitationData data)
{
return false;
}
public InvitationData RetrieveInvitation(UUID inviteID)
{
return null;
}
public InvitationData RetrieveInvitation(UUID groupID, string principalID)
{
return null;
}
public bool DeleteInvite(UUID inviteID)
{
return false;
}
public void DeleteOldInvites()
{
}
#endregion
#region notices table
public bool StoreNotice(NoticeData data)
{
return false;
}
public NoticeData RetrieveNotice(UUID noticeID)
{
return null;
}
public NoticeData[] RetrieveNotices(UUID groupID)
{
return new NoticeData[0];
}
public bool DeleteNotice(UUID noticeID)
{
return false;
}
public void DeleteOldNotices()
{
}
#endregion
}
}

View File

@ -72,12 +72,21 @@ namespace OpenSim.Tests.Permissions
IConfigSource config = new IniConfigSource();
config.AddConfig("Messaging");
config.Configs["Messaging"].Set("InventoryTransferModule", "InventoryTransferModule");
config.AddConfig("Modules");
config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
config.AddConfig("InventoryService");
config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Services.InventoryService.dll:XInventoryService");
config.Configs["InventoryService"].Set("StorageProvider", "OpenSim.Tests.Common.dll:TestXInventoryDataPlugin");
config.AddConfig("Groups");
config.Configs["Groups"].Set("Enabled", "true");
config.Configs["Groups"].Set("Module", "Groups Module V2");
config.Configs["Groups"].Set("StorageProvider", "OpenSim.Tests.Common.dll:TestGroupsDataPlugin");
config.Configs["Groups"].Set("ServicesConnectorModule", "Groups Local Service Connector");
config.Configs["Groups"].Set("LocalService", "local");
m_Scene = new SceneHelpers().SetupScene("Test", UUID.Random(), 1000, 1000, config);
// Add modules
SceneHelpers.SetupSceneModules(m_Scene, config, new DefaultPermissionsModule(), new InventoryTransferModule(), new BasicInventoryAccessModule());

Binary file not shown.