mirror of
https://github.com/opensim/opensim.git
synced 2026-08-04 08:06:27 +08:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
247b9182c1 | ||
|
|
87fc4c1f51 | ||
|
|
1b428a1825 | ||
|
|
6ed9b246cf |
@@ -250,15 +250,16 @@ namespace OpenSim.Data.MySQL
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="uuidss">The assets' IDs</param>
|
/// <param name="uuidss">The assets' IDs</param>
|
||||||
/// <returns>For each asset: true if it exists, false otherwise</returns>
|
/// <returns>For each asset: true if it exists, false otherwise</returns>
|
||||||
|
|
||||||
|
// caller needs to handle exceptions
|
||||||
public override bool[] AssetsExist(UUID[] uuids)
|
public override bool[] AssetsExist(UUID[] uuids)
|
||||||
{
|
{
|
||||||
if (uuids.Length == 0)
|
if (uuids.Length == 0)
|
||||||
return [];
|
return [];
|
||||||
|
|
||||||
HashSet<UUID> exist = new HashSet<UUID>();
|
HashSet<UUID> exist = [];
|
||||||
|
|
||||||
string ids = "'" + string.Join("','", uuids) + "'";
|
string ids = "'" + string.Join("','", uuids) + "'";
|
||||||
string sql = string.Format("SELECT id FROM assets WHERE id IN ({0})", ids);
|
string sql = $"SELECT id FROM assets WHERE id IN ({ids})";
|
||||||
|
|
||||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||||
{
|
{
|
||||||
@@ -274,9 +275,7 @@ namespace OpenSim.Data.MySQL
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dbcon.Close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool[] results = new bool[uuids.Length];
|
bool[] results = new bool[uuids.Length];
|
||||||
for (int i = 0; i < uuids.Length; i++)
|
for (int i = 0; i < uuids.Length; i++)
|
||||||
results[i] = exist.Contains(uuids[i]);
|
results[i] = exist.Contains(uuids[i]);
|
||||||
@@ -294,22 +293,20 @@ namespace OpenSim.Data.MySQL
|
|||||||
/// <returns>A list of AssetMetadata objects.</returns>
|
/// <returns>A list of AssetMetadata objects.</returns>
|
||||||
public override List<AssetMetadata> FetchAssetMetadataSet(int start, int count)
|
public override List<AssetMetadata> FetchAssetMetadataSet(int start, int count)
|
||||||
{
|
{
|
||||||
List<AssetMetadata> retList = new List<AssetMetadata>(count);
|
List<AssetMetadata> retList = new(count);
|
||||||
|
try
|
||||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
|
||||||
{
|
{
|
||||||
dbcon.Open();
|
using (MySqlConnection dbcon = new(m_connectionString))
|
||||||
|
|
||||||
using (MySqlCommand cmd
|
|
||||||
= new MySqlCommand(
|
|
||||||
"SELECT name,description,assetType,temporary,id,asset_flags,CreatorID FROM assets LIMIT ?start, ?count",
|
|
||||||
dbcon))
|
|
||||||
{
|
{
|
||||||
cmd.Parameters.AddWithValue("?start", start);
|
dbcon.Open();
|
||||||
cmd.Parameters.AddWithValue("?count", count);
|
|
||||||
|
|
||||||
try
|
using (MySqlCommand cmd = new(
|
||||||
|
"SELECT name,description,assetType,temporary,id,asset_flags,CreatorID FROM assets LIMIT ?start, ?count",
|
||||||
|
dbcon))
|
||||||
{
|
{
|
||||||
|
cmd.Parameters.AddWithValue("?start", start);
|
||||||
|
cmd.Parameters.AddWithValue("?count", count);
|
||||||
|
|
||||||
using (MySqlDataReader dbReader = cmd.ExecuteReader())
|
using (MySqlDataReader dbReader = cmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
while (dbReader.Read())
|
while (dbReader.Read())
|
||||||
@@ -330,36 +327,39 @@ namespace OpenSim.Data.MySQL
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
return retList;
|
||||||
{
|
|
||||||
m_log.Error(
|
|
||||||
string.Format(
|
|
||||||
"[ASSETS DB]: MySql failure fetching asset set from {0}, count {1}. Exception ",
|
|
||||||
start, count),
|
|
||||||
e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
dbcon.Close();
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.Error($"[ASSETS DB]: MySql failure fetching asset set from {start}, count {1}. Exception ", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return retList;
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Delete(string id)
|
public override bool Delete(string id)
|
||||||
{
|
{
|
||||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
try
|
||||||
{
|
{
|
||||||
dbcon.Open();
|
using (MySqlConnection dbcon = new(m_connectionString))
|
||||||
|
|
||||||
using (MySqlCommand cmd = new MySqlCommand("delete from assets where id=?id", dbcon))
|
|
||||||
{
|
{
|
||||||
cmd.Parameters.AddWithValue("?id", id);
|
dbcon.Open();
|
||||||
cmd.ExecuteNonQuery();
|
|
||||||
|
using (MySqlCommand cmd = new("delete from assets where id=?id", dbcon))
|
||||||
|
{
|
||||||
|
cmd.Parameters.AddWithValue("?id", id);
|
||||||
|
cmd.ExecuteNonQuery();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
dbcon.Close();
|
return true;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.Error($"[ASSETS DB]: MySql failure on delete asset {id}", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace OpenSim.Data.MySQL
|
|||||||
{
|
{
|
||||||
//private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
//private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
protected Dictionary<string, FieldInfo> m_Fields = new Dictionary<string, FieldInfo>();
|
protected Dictionary<string, FieldInfo> m_Fields = [];
|
||||||
|
|
||||||
protected List<string> m_ColumnNames = null;
|
protected List<string> m_ColumnNames = null;
|
||||||
protected string m_Realm;
|
protected string m_Realm;
|
||||||
@@ -71,7 +71,7 @@ namespace OpenSim.Data.MySQL
|
|||||||
if (!string.IsNullOrEmpty(storeName))
|
if (!string.IsNullOrEmpty(storeName))
|
||||||
{
|
{
|
||||||
// We always use a new connection for any Migrations
|
// We always use a new connection for any Migrations
|
||||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
using (MySqlConnection dbcon = new(m_connectionString))
|
||||||
{
|
{
|
||||||
dbcon.Open();
|
dbcon.Open();
|
||||||
Migration m = new Migration(dbcon, Assembly, storeName);
|
Migration m = new Migration(dbcon, Assembly, storeName);
|
||||||
@@ -101,7 +101,7 @@ namespace OpenSim.Data.MySQL
|
|||||||
if (m_ColumnNames != null)
|
if (m_ColumnNames != null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
List<string> columnNames = new List<string>();
|
List<string> columnNames = [];
|
||||||
|
|
||||||
DataTable schemaTable = reader.GetSchemaTable();
|
DataTable schemaTable = reader.GetSchemaTable();
|
||||||
foreach (DataRow row in schemaTable.Rows)
|
foreach (DataRow row in schemaTable.Rows)
|
||||||
@@ -116,7 +116,7 @@ namespace OpenSim.Data.MySQL
|
|||||||
|
|
||||||
public virtual T[] Get(string field, string key)
|
public virtual T[] Get(string field, string key)
|
||||||
{
|
{
|
||||||
using (MySqlCommand cmd = new MySqlCommand())
|
using (MySqlCommand cmd = new())
|
||||||
{
|
{
|
||||||
cmd.Parameters.AddWithValue(field, key);
|
cmd.Parameters.AddWithValue(field, key);
|
||||||
cmd.CommandText = $"select * from {m_Realm} where `{field}` = ?{field}";
|
cmd.CommandText = $"select * from {m_Realm} where `{field}` = ?{field}";
|
||||||
@@ -128,7 +128,7 @@ namespace OpenSim.Data.MySQL
|
|||||||
{
|
{
|
||||||
int flen = keys.Length;
|
int flen = keys.Length;
|
||||||
if(flen == 0)
|
if(flen == 0)
|
||||||
return new T[0];
|
return [];
|
||||||
|
|
||||||
int flast = flen - 1;
|
int flast = flen - 1;
|
||||||
StringBuilder sb = new StringBuilder(1024);
|
StringBuilder sb = new StringBuilder(1024);
|
||||||
@@ -144,7 +144,7 @@ namespace OpenSim.Data.MySQL
|
|||||||
if(i < flast)
|
if(i < flast)
|
||||||
sb.Append(",?");
|
sb.Append(",?");
|
||||||
else
|
else
|
||||||
sb.Append(")");
|
sb.Append(')');
|
||||||
}
|
}
|
||||||
cmd.CommandText = sb.ToString();
|
cmd.CommandText = sb.ToString();
|
||||||
return DoQuery(cmd);
|
return DoQuery(cmd);
|
||||||
@@ -153,14 +153,14 @@ namespace OpenSim.Data.MySQL
|
|||||||
|
|
||||||
public virtual T[] Get(string[] fields, string[] keys)
|
public virtual T[] Get(string[] fields, string[] keys)
|
||||||
{
|
{
|
||||||
return Get(fields, keys, String.Empty);
|
return Get(fields, keys, string.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual T[] Get(string[] fields, string[] keys, string options)
|
public virtual T[] Get(string[] fields, string[] keys, string options)
|
||||||
{
|
{
|
||||||
int flen = fields.Length;
|
int flen = fields.Length;
|
||||||
if (flen == 0 || flen != keys.Length)
|
if (flen == 0 || flen != keys.Length)
|
||||||
return new T[0];
|
return [];
|
||||||
|
|
||||||
int flast = flen - 1;
|
int flast = flen - 1;
|
||||||
StringBuilder sb = new StringBuilder(1024);
|
StringBuilder sb = new StringBuilder(1024);
|
||||||
@@ -188,7 +188,7 @@ namespace OpenSim.Data.MySQL
|
|||||||
{
|
{
|
||||||
if (m_trans == null)
|
if (m_trans == null)
|
||||||
{
|
{
|
||||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
using (MySqlConnection dbcon = new(m_connectionString))
|
||||||
{
|
{
|
||||||
dbcon.Open();
|
dbcon.Open();
|
||||||
T[] ret = DoQueryWithConnection(cmd, dbcon);
|
T[] ret = DoQueryWithConnection(cmd, dbcon);
|
||||||
@@ -211,14 +211,14 @@ namespace OpenSim.Data.MySQL
|
|||||||
|
|
||||||
protected T[] DoQueryWithConnection(MySqlCommand cmd, MySqlConnection dbcon)
|
protected T[] DoQueryWithConnection(MySqlCommand cmd, MySqlConnection dbcon)
|
||||||
{
|
{
|
||||||
List<T> result = new List<T>();
|
List<T> result = [];
|
||||||
|
|
||||||
cmd.Connection = dbcon;
|
cmd.Connection = dbcon;
|
||||||
|
|
||||||
using (IDataReader reader = cmd.ExecuteReader())
|
using (MySqlDataReader reader = cmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
if (reader == null)
|
if (reader == null)
|
||||||
return new T[0];
|
return [];
|
||||||
|
|
||||||
CheckColumnNames(reader);
|
CheckColumnNames(reader);
|
||||||
|
|
||||||
@@ -259,14 +259,13 @@ namespace OpenSim.Data.MySQL
|
|||||||
|
|
||||||
if (m_DataField != null)
|
if (m_DataField != null)
|
||||||
{
|
{
|
||||||
Dictionary<string, string> data =
|
Dictionary<string, string> data = [];
|
||||||
new Dictionary<string, string>();
|
|
||||||
|
|
||||||
foreach (string col in m_ColumnNames)
|
foreach (string col in m_ColumnNames)
|
||||||
{
|
{
|
||||||
data[col] = reader[col].ToString();
|
data[col] = reader[col].ToString();
|
||||||
if (data[col] == null)
|
if (data[col] == null)
|
||||||
data[col] = String.Empty;
|
data[col] = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_DataField.SetValue(row, data);
|
m_DataField.SetValue(row, data);
|
||||||
@@ -281,10 +280,9 @@ namespace OpenSim.Data.MySQL
|
|||||||
|
|
||||||
public virtual T[] Get(string where)
|
public virtual T[] Get(string where)
|
||||||
{
|
{
|
||||||
using (MySqlCommand cmd = new MySqlCommand())
|
using (MySqlCommand cmd = new())
|
||||||
{
|
{
|
||||||
cmd.CommandText = $"select * from {m_Realm} where {where}"; ;
|
cmd.CommandText = $"select * from {m_Realm} where {where}";
|
||||||
|
|
||||||
return DoQuery(cmd);
|
return DoQuery(cmd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -293,11 +291,11 @@ namespace OpenSim.Data.MySQL
|
|||||||
{
|
{
|
||||||
//m_log.DebugFormat("[MYSQL GENERIC TABLE HANDLER]: Store(T row) invoked");
|
//m_log.DebugFormat("[MYSQL GENERIC TABLE HANDLER]: Store(T row) invoked");
|
||||||
|
|
||||||
using (MySqlCommand cmd = new MySqlCommand())
|
using (MySqlCommand cmd = new())
|
||||||
{
|
{
|
||||||
string query = "";
|
string query = "";
|
||||||
List<String> names = new List<String>();
|
List<string> names = [];
|
||||||
List<String> values = new List<String>();
|
List<string> values = [];
|
||||||
|
|
||||||
foreach (FieldInfo fi in m_Fields.Values)
|
foreach (FieldInfo fi in m_Fields.Values)
|
||||||
{
|
{
|
||||||
@@ -340,7 +338,7 @@ namespace OpenSim.Data.MySQL
|
|||||||
|
|
||||||
public virtual bool Delete(string field, string key)
|
public virtual bool Delete(string field, string key)
|
||||||
{
|
{
|
||||||
return Delete(new string[] { field }, new string[] { key });
|
return Delete([field], [key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual bool Delete(string[] fields, string[] keys)
|
public virtual bool Delete(string[] fields, string[] keys)
|
||||||
@@ -375,7 +373,7 @@ namespace OpenSim.Data.MySQL
|
|||||||
|
|
||||||
public long GetCount(string field, string key)
|
public long GetCount(string field, string key)
|
||||||
{
|
{
|
||||||
return GetCount(new string[] { field }, new string[] { key });
|
return GetCount([field], [key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long GetCount(string[] fields, string[] keys)
|
public long GetCount(string[] fields, string[] keys)
|
||||||
@@ -388,7 +386,7 @@ namespace OpenSim.Data.MySQL
|
|||||||
StringBuilder sb = new StringBuilder(1024);
|
StringBuilder sb = new StringBuilder(1024);
|
||||||
sb.AppendFormat("select count(*) from {0} where ", m_Realm);
|
sb.AppendFormat("select count(*) from {0} where ", m_Realm);
|
||||||
|
|
||||||
using (MySqlCommand cmd = new MySqlCommand())
|
using (MySqlCommand cmd = new())
|
||||||
{
|
{
|
||||||
for (int i = 0 ; i < flen ; i++)
|
for (int i = 0 ; i < flen ; i++)
|
||||||
{
|
{
|
||||||
@@ -408,12 +406,9 @@ namespace OpenSim.Data.MySQL
|
|||||||
|
|
||||||
public long GetCount(string where)
|
public long GetCount(string where)
|
||||||
{
|
{
|
||||||
using (MySqlCommand cmd = new MySqlCommand())
|
using (MySqlCommand cmd = new() )
|
||||||
{
|
{
|
||||||
string query = String.Format("select count(*) from {0} where {1}",
|
cmd.CommandText = $"select count(*) from {m_Realm} where {where}";
|
||||||
m_Realm, where);
|
|
||||||
|
|
||||||
cmd.CommandText = query;
|
|
||||||
|
|
||||||
object result = DoQueryScalar(cmd);
|
object result = DoQueryScalar(cmd);
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ namespace OpenSim.Data.MySQL
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class MySQLGridUserData : MySQLGenericTableHandler<GridUserData>, IGridUserData
|
public class MySQLGridUserData : MySQLGenericTableHandler<GridUserData>, IGridUserData
|
||||||
{
|
{
|
||||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
//private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
public MySQLGridUserData(string connectionString, string realm) : base(connectionString, realm, "GridUserStore") {}
|
public MySQLGridUserData(string connectionString, string realm) : base(connectionString, realm, "GridUserStore") {}
|
||||||
|
|
||||||
@@ -58,6 +58,7 @@ namespace OpenSim.Data.MySQL
|
|||||||
|
|
||||||
public GridUserData[] GetAll(string userID)
|
public GridUserData[] GetAll(string userID)
|
||||||
{
|
{
|
||||||
|
userID = MySqlHelper.EscapeString(userID);
|
||||||
return base.Get(String.Format("UserID LIKE '{0}%'", userID));
|
return base.Get(String.Format("UserID LIKE '{0}%'", userID));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ namespace OpenSim.Data.MySQL
|
|||||||
|
|
||||||
public UserAccountData[] GetUsers(UUID scopeID, string query)
|
public UserAccountData[] GetUsers(UUID scopeID, string query)
|
||||||
{
|
{
|
||||||
string[] words = query.Split();
|
string[] words = query.Split(' ', StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
|
||||||
bool valid = false;
|
bool valid = false;
|
||||||
|
|
||||||
@@ -52,19 +52,10 @@ namespace OpenSim.Data.MySQL
|
|||||||
{
|
{
|
||||||
if (words[i].Length > 2)
|
if (words[i].Length > 2)
|
||||||
valid = true;
|
valid = true;
|
||||||
// if (words[i].Length < 3)
|
|
||||||
// {
|
|
||||||
// if (i != words.Length - 1)
|
|
||||||
// Array.Copy(words, i + 1, words, i, words.Length - i - 1);
|
|
||||||
// Array.Resize(ref words, words.Length - 1);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((!valid) || words.Length == 0)
|
if ((!valid) || words.Length == 0 || words.Length > 2)
|
||||||
return new UserAccountData[0];
|
return [];
|
||||||
|
|
||||||
if (words.Length > 2)
|
|
||||||
return new UserAccountData[0];
|
|
||||||
|
|
||||||
using (MySqlCommand cmd = new MySqlCommand())
|
using (MySqlCommand cmd = new MySqlCommand())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1007,7 +1007,7 @@ namespace OpenSim.Data.MySQL
|
|||||||
cmd.Parameters.AddWithValue("?UserId", props.UserId.ToString());
|
cmd.Parameters.AddWithValue("?UserId", props.UserId.ToString());
|
||||||
cmd.Parameters.AddWithValue("?TagId", props.TagId.ToString());
|
cmd.Parameters.AddWithValue("?TagId", props.TagId.ToString());
|
||||||
cmd.Parameters.AddWithValue("?DataKey", props.DataKey.ToString());
|
cmd.Parameters.AddWithValue("?DataKey", props.DataKey.ToString());
|
||||||
cmd.Parameters.AddWithValue("?DataVal", props.DataKey.ToString());
|
cmd.Parameters.AddWithValue("?DataVal", props.DataVal.ToString());
|
||||||
|
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -406,7 +406,7 @@ namespace OpenSim.Data.MySQL
|
|||||||
HashSet<UUID> exists = new HashSet<UUID>();
|
HashSet<UUID> exists = new HashSet<UUID>();
|
||||||
|
|
||||||
string ids = "'" + string.Join("','", uuids) + "'";
|
string ids = "'" + string.Join("','", uuids) + "'";
|
||||||
string sql = string.Format("SELECT ID FROM assets WHERE ID IN ({0})", ids);
|
string sql = $"SELECT ID FROM XAssetsMeta WHERE ID IN ({ids})";
|
||||||
|
|
||||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -224,7 +224,7 @@ namespace OpenSim.Data.PGSQL
|
|||||||
}
|
}
|
||||||
if (PGFieldType == "boolean" || PGFieldType == "bit")
|
if (PGFieldType == "boolean" || PGFieldType == "bit")
|
||||||
{
|
{
|
||||||
return (value.ToString() == "true");
|
return "true".Equals(value.ToString(), StringComparison.OrdinalIgnoreCase);
|
||||||
}
|
}
|
||||||
if (PGFieldType == "timestamp with time zone")
|
if (PGFieldType == "timestamp with time zone")
|
||||||
{
|
{
|
||||||
@@ -307,7 +307,7 @@ namespace OpenSim.Data.PGSQL
|
|||||||
internal NpgsqlParameter CreateParameter(string parameterName, object parameterObject, string PGFieldType)
|
internal NpgsqlParameter CreateParameter(string parameterName, object parameterObject, string PGFieldType)
|
||||||
{
|
{
|
||||||
//Tweak so we dont always have to add : sign
|
//Tweak so we dont always have to add : sign
|
||||||
if (parameterName.StartsWith(":")) parameterName = parameterName.Replace(":", "");
|
if (parameterName.StartsWith(':')) parameterName = parameterName[1..];
|
||||||
|
|
||||||
//HACK if object is null, it is turned into a string, there are no nullable type till now
|
//HACK if object is null, it is turned into a string, there are no nullable type till now
|
||||||
if (parameterObject == null) parameterObject = "";
|
if (parameterObject == null) parameterObject = "";
|
||||||
|
|||||||
@@ -274,7 +274,7 @@ namespace OpenSim.Data.PGSQL
|
|||||||
|
|
||||||
public UserAccountData[] GetUsers(UUID scopeID, string query)
|
public UserAccountData[] GetUsers(UUID scopeID, string query)
|
||||||
{
|
{
|
||||||
string[] words = query.Split();
|
string[] words = query.Split(' ', StringSplitOptions.RemoveEmptyEntries);;
|
||||||
|
|
||||||
for (int i = 0; i < words.Length; i++)
|
for (int i = 0; i < words.Length; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1042,7 +1042,7 @@ namespace OpenSim.Data.PGSQL
|
|||||||
cmd.Parameters.Add(m_database.CreateParameter("UserId", props.UserId.ToString()));
|
cmd.Parameters.Add(m_database.CreateParameter("UserId", props.UserId.ToString()));
|
||||||
cmd.Parameters.Add(m_database.CreateParameter("TagId", props.TagId.ToString()));
|
cmd.Parameters.Add(m_database.CreateParameter("TagId", props.TagId.ToString()));
|
||||||
cmd.Parameters.Add(m_database.CreateParameter("DataKey", props.DataKey.ToString()));
|
cmd.Parameters.Add(m_database.CreateParameter("DataKey", props.DataKey.ToString()));
|
||||||
cmd.Parameters.Add(m_database.CreateParameter("DataVal", props.DataKey.ToString()));
|
cmd.Parameters.Add(m_database.CreateParameter("DataVal", props.DataVal.ToString()));
|
||||||
|
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ namespace OpenSim.Data.SQLite
|
|||||||
|
|
||||||
public UserAccountData[] GetUsers(UUID scopeID, string query)
|
public UserAccountData[] GetUsers(UUID scopeID, string query)
|
||||||
{
|
{
|
||||||
string[] words = query.Split();
|
string[] words = query.Split(' ', StringSplitOptions.RemoveEmptyEntries);;
|
||||||
|
|
||||||
for (int i = 0 ; i < words.Length ; i++)
|
for (int i = 0 ; i < words.Length ; i++)
|
||||||
{
|
{
|
||||||
@@ -56,11 +56,8 @@ namespace OpenSim.Data.SQLite
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (words.Length == 0)
|
if (words.Length == 0 || words.Length > 2)
|
||||||
return new UserAccountData[0];
|
return [];
|
||||||
|
|
||||||
if (words.Length > 2)
|
|
||||||
return new UserAccountData[0];
|
|
||||||
|
|
||||||
using (SQLiteCommand cmd = new SQLiteCommand())
|
using (SQLiteCommand cmd = new SQLiteCommand())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -851,11 +851,12 @@ namespace OpenSim.Data.SQLite
|
|||||||
query += ":UserId,";
|
query += ":UserId,";
|
||||||
query += ":TagId,";
|
query += ":TagId,";
|
||||||
query += ":DataKey,";
|
query += ":DataKey,";
|
||||||
query += ":DataVal) ";
|
query += ":DataVal) ";
|
||||||
|
|
||||||
using (SQLiteCommand put = (SQLiteCommand)m_connection.CreateCommand())
|
using (SQLiteCommand put = (SQLiteCommand)m_connection.CreateCommand())
|
||||||
{
|
{
|
||||||
put.Parameters.AddWithValue(":Id", props.UserId.ToString());
|
cmd.CommandText = query;
|
||||||
|
put.Parameters.AddWithValue(":UserId", props.UserId.ToString());
|
||||||
put.Parameters.AddWithValue(":TagId", props.TagId.ToString());
|
put.Parameters.AddWithValue(":TagId", props.TagId.ToString());
|
||||||
put.Parameters.AddWithValue(":DataKey", props.DataKey.ToString());
|
put.Parameters.AddWithValue(":DataKey", props.DataKey.ToString());
|
||||||
put.Parameters.AddWithValue(":DataVal", props.DataVal.ToString());
|
put.Parameters.AddWithValue(":DataVal", props.DataVal.ToString());
|
||||||
|
|||||||
@@ -2242,7 +2242,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||||||
foreach (UserData ud in names)
|
foreach (UserData ud in names)
|
||||||
{
|
{
|
||||||
// dont tell about unknown users, we can't send them back on Bad either
|
// dont tell about unknown users, we can't send them back on Bad either
|
||||||
if (string.IsNullOrEmpty(ud.FirstName) || ud.FirstName.Equals("Unkown"))
|
if (string.IsNullOrEmpty(ud.FirstName) || ud.FirstName.Equals("Unknown"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
string fullname = ud.FirstName + " " + ud.LastName;
|
string fullname = ud.FirstName + " " + ud.LastName;
|
||||||
|
|||||||
@@ -216,7 +216,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
|
|||||||
|
|
||||||
if(!m_scenes.Contains(scene))
|
if(!m_scenes.Contains(scene))
|
||||||
{
|
{
|
||||||
m_log.WarnFormat("[CHAT]: message from unkown scene {0} ignored",
|
m_log.WarnFormat("[CHAT]: message from unknown scene {0} ignored",
|
||||||
scene.RegionInfo.RegionName);
|
scene.RegionInfo.RegionName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
|
|||||||
if (killingAvatar == null)
|
if (killingAvatar == null)
|
||||||
{
|
{
|
||||||
IUserManagement userManager = deadAvatar.Scene.RequestModuleInterface<IUserManagement>();
|
IUserManagement userManager = deadAvatar.Scene.RequestModuleInterface<IUserManagement>();
|
||||||
string userName = "Unkown User";
|
string userName = "Unknown User";
|
||||||
if (userManager != null)
|
if (userManager != null)
|
||||||
userName = userManager.GetUserName(part.OwnerID);
|
userName = userManager.GetUserName(part.OwnerID);
|
||||||
deadAvatarMessage = String.Format("You impaled yourself on {0} owned by {1}!", part.Name, userName);
|
deadAvatarMessage = String.Format("You impaled yourself on {0} owned by {1}!", part.Name, userName);
|
||||||
|
|||||||
@@ -530,7 +530,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// unkown map item type
|
// Unknown map item type
|
||||||
m_log.DebugFormat("[WORLD MAP]: Unknown MapItem type {0}", itemtype);
|
m_log.DebugFormat("[WORLD MAP]: Unknown MapItem type {0}", itemtype);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -784,6 +784,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
|
|
||||||
|
|
||||||
public Scene(RegionInfo regInfo, AgentCircuitManager authen,
|
public Scene(RegionInfo regInfo, AgentCircuitManager authen,
|
||||||
ISimulationDataService simDataService, IEstateDataService estateDataService,
|
ISimulationDataService simDataService, IEstateDataService estateDataService,
|
||||||
IConfigSource config, string simulatorVersion)
|
IConfigSource config, string simulatorVersion)
|
||||||
@@ -1004,7 +1005,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||||||
m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl);
|
m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl);
|
||||||
m_seeIntoBannedRegion = startupConfig.GetBoolean("SeeIntoBannedRegion", m_seeIntoBannedRegion);
|
m_seeIntoBannedRegion = startupConfig.GetBoolean("SeeIntoBannedRegion", m_seeIntoBannedRegion);
|
||||||
|
|
||||||
string[] possibleMapConfigSections = new string[] { "Map", "Startup" };
|
|
||||||
|
string[] possibleMapConfigSections = ["Map", "Startup"];
|
||||||
|
|
||||||
m_generateMaptiles
|
m_generateMaptiles
|
||||||
= Util.GetConfigVarFromSections<bool>(config, "GenerateMaptiles", possibleMapConfigSections, true);
|
= Util.GetConfigVarFromSections<bool>(config, "GenerateMaptiles", possibleMapConfigSections, true);
|
||||||
@@ -1037,7 +1039,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string[] possibleAccessControlConfigSections = new string[] { "Startup", "AccessControl"};
|
string[] possibleAccessControlConfigSections = ["Startup", "AccessControl"];
|
||||||
|
|
||||||
string grant = Util.GetConfigVarFromSections<string>(
|
string grant = Util.GetConfigVarFromSections<string>(
|
||||||
config, "AllowedClients", possibleAccessControlConfigSections, string.Empty);
|
config, "AllowedClients", possibleAccessControlConfigSections, string.Empty);
|
||||||
@@ -1078,7 +1080,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||||||
m_update_terrain = startupConfig.GetInt("UpdateTerrainEveryNFrames", m_update_terrain);
|
m_update_terrain = startupConfig.GetInt("UpdateTerrainEveryNFrames", m_update_terrain);
|
||||||
m_update_temp_cleaning = startupConfig.GetInt("UpdateTempCleaningEveryNSeconds", m_update_temp_cleaning);
|
m_update_temp_cleaning = startupConfig.GetInt("UpdateTempCleaningEveryNSeconds", m_update_temp_cleaning);
|
||||||
|
|
||||||
string[] possibleScriptConfigSections = new string[] { "YEngine", "Xengine", "Scripts" };
|
string[] possibleScriptConfigSections = ["YEngine", "Xengine", "Scripts"];
|
||||||
m_LinkSetDataLimit = Util.GetConfigVarFromSections<int>(config, "LinksetDataLimit", possibleScriptConfigSections, m_LinkSetDataLimit);
|
m_LinkSetDataLimit = Util.GetConfigVarFromSections<int>(config, "LinksetDataLimit", possibleScriptConfigSections, m_LinkSetDataLimit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -318,7 +318,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||||||
protected Vector3 m_acceleration;
|
protected Vector3 m_acceleration;
|
||||||
protected Vector3 m_angularVelocity;
|
protected Vector3 m_angularVelocity;
|
||||||
|
|
||||||
//unkown if this will be kept, added as a way of removing the group position from the group class
|
//Unknown if this will be kept, added as a way of removing the group position from the group class
|
||||||
protected Vector3 m_groupPosition;
|
protected Vector3 m_groupPosition;
|
||||||
protected Material m_material = OpenMetaverse.Material.Wood;
|
protected Material m_material = OpenMetaverse.Material.Wood;
|
||||||
protected Vector3 m_offsetPosition;
|
protected Vector3 m_offsetPosition;
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ namespace OpenSim.Server.Handlers.Presence
|
|||||||
if (request.TryGetValue("UserID", out object uo) && uo is string user)
|
if (request.TryGetValue("UserID", out object uo) && uo is string user)
|
||||||
m_log.Debug($"[PRESENCE HANDLER]: ilegal login try from {httpRequest.RemoteIPEndPoint} for userID {user}");
|
m_log.Debug($"[PRESENCE HANDLER]: ilegal login try from {httpRequest.RemoteIPEndPoint} for userID {user}");
|
||||||
else
|
else
|
||||||
m_log.Debug($"[PRESENCE HANDLER]: ilegal login try from {httpRequest.RemoteIPEndPoint} for unkown user");
|
m_log.Debug($"[PRESENCE HANDLER]: ilegal login try from {httpRequest.RemoteIPEndPoint} for unknown user");
|
||||||
|
|
||||||
return FailureResult();
|
return FailureResult();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -156,8 +156,8 @@ namespace OpenSim.Services.AssetService
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
UUID[] uuid = Array.ConvertAll(ids, id => UUID.Parse(id));
|
UUID[] uuids = Array.ConvertAll(ids, id => UUID.Parse(id));
|
||||||
return m_Database.AssetsExist(uuid);
|
return m_Database.AssetsExist(uuids);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@@ -192,13 +192,12 @@ namespace OpenSim.Services.AssetService
|
|||||||
|
|
||||||
public virtual bool Delete(string id)
|
public virtual bool Delete(string id)
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat("[ASSET SERVICE]: Deleting asset {0}", id);
|
//m_log.DebugFormat("[ASSET SERVICE]: Deleting asset {0}", id);
|
||||||
|
|
||||||
UUID assetID;
|
if (UUID.TryParse(id, out _))
|
||||||
if (!UUID.TryParse(id, out assetID))
|
return m_Database.Delete(id);
|
||||||
return false;
|
|
||||||
|
|
||||||
return m_Database.Delete(id);
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Get(string id, string ForeignAssetService, bool StoreOnLocalGrid, SimpleAssetRetrieved callBack)
|
public void Get(string id, string ForeignAssetService, bool StoreOnLocalGrid, SimpleAssetRetrieved callBack)
|
||||||
|
|||||||
Reference in New Issue
Block a user