Merge branch 'master' into careminster-presence-refactor
commit
e62d1cc480
|
@ -74,9 +74,38 @@ namespace OpenSim.Data
|
||||||
bool StoreFolder(XInventoryFolder folder);
|
bool StoreFolder(XInventoryFolder folder);
|
||||||
bool StoreItem(XInventoryItem item);
|
bool StoreItem(XInventoryItem item);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Delete folders where field == val
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="field"></param>
|
||||||
|
/// <param name="val"></param>
|
||||||
|
/// <returns>true if the delete was successful, false if it was not</returns>
|
||||||
bool DeleteFolders(string field, string val);
|
bool DeleteFolders(string field, string val);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Delete folders where field1 == val1, field2 == val2...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="fields"></param>
|
||||||
|
/// <param name="vals"></param>
|
||||||
|
/// <returns>true if the delete was successful, false if it was not</returns>
|
||||||
|
bool DeleteFolders(string[] fields, string[] vals);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Delete items where field == val
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="field"></param>
|
||||||
|
/// <param name="val"></param>
|
||||||
|
/// <returns>true if the delete was successful, false if it was not</returns>
|
||||||
bool DeleteItems(string field, string val);
|
bool DeleteItems(string field, string val);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Delete items where field1 == val1, field2 == val2...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="fields"></param>
|
||||||
|
/// <param name="vals"></param>
|
||||||
|
/// <returns>true if the delete was successful, false if it was not</returns>
|
||||||
|
bool DeleteItems(string[] fields, string[] vals);
|
||||||
|
|
||||||
bool MoveItem(string id, string newParent);
|
bool MoveItem(string id, string newParent);
|
||||||
XInventoryItem[] GetActiveGestures(UUID principalID);
|
XInventoryItem[] GetActiveGestures(UUID principalID);
|
||||||
int GetAssetPermissions(UUID principalID, UUID assetID);
|
int GetAssetPermissions(UUID principalID, UUID assetID);
|
||||||
|
|
|
@ -335,24 +335,35 @@ namespace OpenSim.Data.MSSQL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual bool Delete(string field, string val)
|
public virtual bool Delete(string field, string key)
|
||||||
{
|
{
|
||||||
|
return Delete(new string[] { field }, new string[] { key });
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual bool Delete(string[] fields, string[] keys)
|
||||||
|
{
|
||||||
|
if (fields.Length != keys.Length)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
List<string> terms = new List<string>();
|
||||||
|
|
||||||
using (SqlConnection conn = new SqlConnection(m_ConnectionString))
|
using (SqlConnection conn = new SqlConnection(m_ConnectionString))
|
||||||
using (SqlCommand cmd = new SqlCommand())
|
using (SqlCommand cmd = new SqlCommand())
|
||||||
{
|
{
|
||||||
string deleteCommand = String.Format("DELETE FROM {0} WHERE [{1}] = @{1}", m_Realm, field);
|
for (int i = 0; i < fields.Length; i++)
|
||||||
cmd.CommandText = deleteCommand;
|
|
||||||
|
|
||||||
cmd.Parameters.Add(m_database.CreateParameter(field, val));
|
|
||||||
cmd.Connection = conn;
|
|
||||||
conn.Open();
|
|
||||||
|
|
||||||
if (cmd.ExecuteNonQuery() > 0)
|
|
||||||
{
|
{
|
||||||
//m_log.Warn("[MSSQLGenericTable]: " + deleteCommand);
|
cmd.Parameters.Add(m_database.CreateParameter(fields[i], keys[i]));
|
||||||
return true;
|
terms.Add("[" + fields[i] + "] = @" + fields[i]);
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
|
string where = String.Join(" AND ", terms.ToArray());
|
||||||
|
|
||||||
|
string query = String.Format("DELETE * FROM {0} WHERE {1}", m_Realm, where);
|
||||||
|
|
||||||
|
cmd.Connection = conn;
|
||||||
|
cmd.CommandText = query;
|
||||||
|
conn.Open();
|
||||||
|
return cmd.ExecuteNonQuery() > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,11 +79,21 @@ namespace OpenSim.Data.MSSQL
|
||||||
return m_Folders.Delete(field, val);
|
return m_Folders.Delete(field, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool DeleteFolders(string[] fields, string[] vals)
|
||||||
|
{
|
||||||
|
return m_Folders.Delete(fields, vals);
|
||||||
|
}
|
||||||
|
|
||||||
public bool DeleteItems(string field, string val)
|
public bool DeleteItems(string field, string val)
|
||||||
{
|
{
|
||||||
return m_Items.Delete(field, val);
|
return m_Items.Delete(field, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool DeleteItems(string[] fields, string[] vals)
|
||||||
|
{
|
||||||
|
return m_Items.Delete(fields, vals);
|
||||||
|
}
|
||||||
|
|
||||||
public bool MoveItem(string id, string newParent)
|
public bool MoveItem(string id, string newParent)
|
||||||
{
|
{
|
||||||
return m_Items.MoveItem(id, newParent);
|
return m_Items.MoveItem(id, newParent);
|
||||||
|
|
|
@ -264,18 +264,33 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual bool Delete(string field, string val)
|
public virtual bool Delete(string field, string key)
|
||||||
{
|
{
|
||||||
|
return Delete(new string[] { field }, new string[] { key });
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual bool Delete(string[] fields, string[] keys)
|
||||||
|
{
|
||||||
|
if (fields.Length != keys.Length)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
List<string> terms = new List<string>();
|
||||||
|
|
||||||
using (MySqlCommand cmd = new MySqlCommand())
|
using (MySqlCommand cmd = new MySqlCommand())
|
||||||
{
|
{
|
||||||
|
for (int i = 0 ; i < fields.Length ; i++)
|
||||||
|
{
|
||||||
|
cmd.Parameters.AddWithValue(fields[i], keys[i]);
|
||||||
|
terms.Add("`" + fields[i] + "` = ?" + fields[i]);
|
||||||
|
}
|
||||||
|
|
||||||
cmd.CommandText = String.Format("delete from {0} where `{1}` = ?{1}", m_Realm, field);
|
string where = String.Join(" and ", terms.ToArray());
|
||||||
cmd.Parameters.AddWithValue(field, val);
|
|
||||||
|
|
||||||
if (ExecuteNonQuery(cmd) > 0)
|
string query = String.Format("delete from {0} where {1}", m_Realm, where);
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
cmd.CommandText = query;
|
||||||
|
|
||||||
|
return ExecuteNonQuery(cmd) > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,11 +85,21 @@ namespace OpenSim.Data.MySQL
|
||||||
return m_Folders.Delete(field, val);
|
return m_Folders.Delete(field, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool DeleteFolders(string[] fields, string[] vals)
|
||||||
|
{
|
||||||
|
return m_Folders.Delete(fields, vals);
|
||||||
|
}
|
||||||
|
|
||||||
public bool DeleteItems(string field, string val)
|
public bool DeleteItems(string field, string val)
|
||||||
{
|
{
|
||||||
return m_Items.Delete(field, val);
|
return m_Items.Delete(field, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool DeleteItems(string[] fields, string[] vals)
|
||||||
|
{
|
||||||
|
return m_Items.Delete(fields, vals);
|
||||||
|
}
|
||||||
|
|
||||||
public bool MoveItem(string id, string newParent)
|
public bool MoveItem(string id, string newParent)
|
||||||
{
|
{
|
||||||
return m_Items.MoveItem(id, newParent);
|
return m_Items.MoveItem(id, newParent);
|
||||||
|
|
|
@ -258,17 +258,33 @@ namespace OpenSim.Data.SQLite
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Delete(string field, string val)
|
public virtual bool Delete(string field, string key)
|
||||||
{
|
{
|
||||||
|
return Delete(new string[] { field }, new string[] { key });
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Delete(string[] fields, string[] keys)
|
||||||
|
{
|
||||||
|
if (fields.Length != keys.Length)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
List<string> terms = new List<string>();
|
||||||
|
|
||||||
SqliteCommand cmd = new SqliteCommand();
|
SqliteCommand cmd = new SqliteCommand();
|
||||||
|
|
||||||
cmd.CommandText = String.Format("delete from {0} where `{1}` = :{1}", m_Realm, field);
|
for (int i = 0 ; i < fields.Length ; i++)
|
||||||
cmd.Parameters.Add(new SqliteParameter(field, val));
|
{
|
||||||
|
cmd.Parameters.Add(new SqliteParameter(":" + fields[i], keys[i]));
|
||||||
|
terms.Add("`" + fields[i] + "` = :" + fields[i]);
|
||||||
|
}
|
||||||
|
|
||||||
if (ExecuteNonQuery(cmd, m_Connection) > 0)
|
string where = String.Join(" and ", terms.ToArray());
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
string query = String.Format("delete * from {0} where {1}", m_Realm, where);
|
||||||
|
|
||||||
|
cmd.CommandText = query;
|
||||||
|
|
||||||
|
return ExecuteNonQuery(cmd, m_Connection) > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,11 +91,21 @@ namespace OpenSim.Data.SQLite
|
||||||
return m_Folders.Delete(field, val);
|
return m_Folders.Delete(field, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool DeleteFolders(string[] fields, string[] vals)
|
||||||
|
{
|
||||||
|
return m_Folders.Delete(fields, vals);
|
||||||
|
}
|
||||||
|
|
||||||
public bool DeleteItems(string field, string val)
|
public bool DeleteItems(string field, string val)
|
||||||
{
|
{
|
||||||
return m_Items.Delete(field, val);
|
return m_Items.Delete(field, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool DeleteItems(string[] fields, string[] vals)
|
||||||
|
{
|
||||||
|
return m_Items.Delete(fields, vals);
|
||||||
|
}
|
||||||
|
|
||||||
public bool MoveItem(string id, string newParent)
|
public bool MoveItem(string id, string newParent)
|
||||||
{
|
{
|
||||||
return m_Items.MoveItem(id, newParent);
|
return m_Items.MoveItem(id, newParent);
|
||||||
|
|
|
@ -974,7 +974,7 @@ namespace OpenSim.Framework
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.WarnFormat("[SynchronousRestObjectRequester]: exception in sending data to {0}: {1}", requestUrl, e);
|
m_log.DebugFormat("[SynchronousRestObjectRequester]: exception in sending data to {0}: {1}", requestUrl, e);
|
||||||
return deserial;
|
return deserial;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
@ -999,18 +999,18 @@ namespace OpenSim.Framework
|
||||||
respStream.Close();
|
respStream.Close();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_log.WarnFormat("[SynchronousRestObjectRequester]: Oops! no content found in response stream from {0} {1}", requestUrl, verb);
|
m_log.DebugFormat("[SynchronousRestObjectRequester]: Oops! no content found in response stream from {0} {1}", requestUrl, verb);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (System.InvalidOperationException)
|
catch (System.InvalidOperationException)
|
||||||
{
|
{
|
||||||
// This is what happens when there is invalid XML
|
// This is what happens when there is invalid XML
|
||||||
m_log.WarnFormat("[SynchronousRestObjectRequester]: Invalid XML {0} {1}", requestUrl, typeof(TResponse).ToString());
|
m_log.DebugFormat("[SynchronousRestObjectRequester]: Invalid XML {0} {1}", requestUrl, typeof(TResponse).ToString());
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.WarnFormat("[SynchronousRestObjectRequester]: Exception on response from {0} {1}", requestUrl, e);
|
m_log.DebugFormat("[SynchronousRestObjectRequester]: Exception on response from {0} {1}", requestUrl, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return deserial;
|
return deserial;
|
||||||
|
|
|
@ -1423,7 +1423,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (item.AssetType == (int)AssetType.Link)
|
if (item.AssetType == (int)AssetType.Link)
|
||||||
{
|
{
|
||||||
InventoryItemBase linkedItem = InventoryService.GetItem(new InventoryItemBase(item.AssetID));
|
InventoryItemBase linkedItem = InventoryService.GetItem(new InventoryItemBase(item.AssetID));
|
||||||
linkedItemFolderIdsToSend.Add(linkedItem.Folder);
|
|
||||||
|
// Take care of genuinely broken links where the target doesn't exist
|
||||||
|
if (linkedItem != null)
|
||||||
|
linkedItemFolderIdsToSend.Add(linkedItem.Folder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -620,7 +620,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
"delete object uuid <UUID>",
|
"delete object uuid <UUID>",
|
||||||
"Delete object by uuid", HandleDeleteObject);
|
"Delete object by uuid", HandleDeleteObject);
|
||||||
MainConsole.Instance.Commands.AddCommand("region", false, "delete object name",
|
MainConsole.Instance.Commands.AddCommand("region", false, "delete object name",
|
||||||
"delete object name <UUID>",
|
"delete object name <name>",
|
||||||
"Delete object by name", HandleDeleteObject);
|
"Delete object by name", HandleDeleteObject);
|
||||||
|
|
||||||
//Bind Storage Manager functions to some land manager functions for this scene
|
//Bind Storage Manager functions to some land manager functions for this scene
|
||||||
|
|
|
@ -58,12 +58,9 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// Config Settings Documentation.
|
/// Config Settings Documentation.
|
||||||
/// At the TOP LEVEL, e.g. in OpenSim.ini, we have the following options:
|
/// Each configuration setting can be specified in two places: OpenSim.ini or Regions.ini.
|
||||||
/// EACH REGION, in OpenSim.ini, can have the following settings under the [AutoBackupModule] section.
|
/// If specified in Regions.ini, the settings should be within the region's section name.
|
||||||
/// IMPORTANT: You may optionally specify the key name as follows for a per-region key: [Region Name].[Key Name]
|
/// If specified in OpenSim.ini, the settings should be within the [AutoBackupModule] section.
|
||||||
/// Example: My region is named Foo.
|
|
||||||
/// If I wanted to specify the "AutoBackupInterval" key just for this region, I would name my key "Foo.AutoBackupInterval", under the [AutoBackupModule] section of OpenSim.ini.
|
|
||||||
/// Instead of specifying them on a per-region basis, you can also omit the region name to specify the default setting for all regions.
|
|
||||||
/// Region-specific settings take precedence.
|
/// Region-specific settings take precedence.
|
||||||
///
|
///
|
||||||
/// AutoBackupModuleEnabled: True/False. Default: False. If True, use the auto backup module. This setting does not support per-region basis.
|
/// AutoBackupModuleEnabled: True/False. Default: False. If True, use the auto backup module. This setting does not support per-region basis.
|
||||||
|
@ -71,7 +68,7 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
|
||||||
/// AutoBackup: True/False. Default: False. If True, activate auto backup functionality.
|
/// AutoBackup: True/False. Default: False. If True, activate auto backup functionality.
|
||||||
/// This is the only required option for enabling auto-backup; the other options have sane defaults.
|
/// This is the only required option for enabling auto-backup; the other options have sane defaults.
|
||||||
/// If False for a particular region, the auto-backup module becomes a no-op for the region, and all other AutoBackup* settings are ignored.
|
/// If False for a particular region, the auto-backup module becomes a no-op for the region, and all other AutoBackup* settings are ignored.
|
||||||
/// If False globally (the default), only regions that specifically override this with "FooRegion.AutoBackup = true" will get AutoBackup functionality.
|
/// If False globally (the default), only regions that specifically override it in Regions.ini will get AutoBackup functionality.
|
||||||
/// AutoBackupInterval: Double, non-negative value. Default: 720 (12 hours).
|
/// AutoBackupInterval: Double, non-negative value. Default: 720 (12 hours).
|
||||||
/// The number of minutes between each backup attempt.
|
/// The number of minutes between each backup attempt.
|
||||||
/// If a negative or zero value is given, it is equivalent to setting AutoBackup = False.
|
/// If a negative or zero value is given, it is equivalent to setting AutoBackup = False.
|
||||||
|
|
|
@ -4887,6 +4887,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LSL_Integer llGetLinkNumberOfSides(int link)
|
||||||
|
{
|
||||||
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
|
SceneObjectPart linkedPart;
|
||||||
|
|
||||||
|
if (link == ScriptBaseClass.LINK_ROOT)
|
||||||
|
linkedPart = m_host.ParentGroup.RootPart;
|
||||||
|
else if (link == ScriptBaseClass.LINK_THIS)
|
||||||
|
linkedPart = m_host;
|
||||||
|
else
|
||||||
|
linkedPart = m_host.ParentGroup.GetLinkNumPart(link);
|
||||||
|
|
||||||
|
return GetNumberOfSides(linkedPart);
|
||||||
|
}
|
||||||
|
|
||||||
public LSL_Integer llGetNumberOfSides()
|
public LSL_Integer llGetNumberOfSides()
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
|
@ -1530,6 +1530,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
|
||||||
public struct LSLInteger
|
public struct LSLInteger
|
||||||
{
|
{
|
||||||
public int value;
|
public int value;
|
||||||
|
private static readonly Regex castRegex = new Regex(@"(^[ ]*0[xX][0-9A-Fa-f][0-9A-Fa-f]*)|(^[ ]*(-?|\+?)[0-9][0-9]*)");
|
||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
public LSLInteger(int i)
|
public LSLInteger(int i)
|
||||||
|
@ -1549,9 +1550,10 @@ namespace OpenSim.Region.ScriptEngine.Shared
|
||||||
|
|
||||||
public LSLInteger(string s)
|
public LSLInteger(string s)
|
||||||
{
|
{
|
||||||
Regex r = new Regex("(^[ ]*0[xX][0-9A-Fa-f][0-9A-Fa-f]*)|(^[ ]*-?[0-9][0-9]*)");
|
Match m = castRegex.Match(s);
|
||||||
Match m = r.Match(s);
|
|
||||||
string v = m.Groups[0].Value;
|
string v = m.Groups[0].Value;
|
||||||
|
// Leading plus sign is allowed, but ignored
|
||||||
|
v = v.Replace("+", "");
|
||||||
|
|
||||||
if (v == String.Empty)
|
if (v == String.Empty)
|
||||||
{
|
{
|
||||||
|
|
|
@ -393,6 +393,10 @@ namespace OpenSim.Services.InventoryService
|
||||||
|
|
||||||
public virtual bool UpdateItem(InventoryItemBase item)
|
public virtual bool UpdateItem(InventoryItemBase item)
|
||||||
{
|
{
|
||||||
|
if (!m_AllowDelete)
|
||||||
|
if (item.AssetType == (sbyte)AssetType.Link || item.AssetType == (sbyte)AssetType.LinkFolder)
|
||||||
|
return false;
|
||||||
|
|
||||||
return m_Database.StoreItem(ConvertFromOpenSim(item));
|
return m_Database.StoreItem(ConvertFromOpenSim(item));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -411,12 +415,30 @@ namespace OpenSim.Services.InventoryService
|
||||||
public virtual bool DeleteItems(UUID principalID, List<UUID> itemIDs)
|
public virtual bool DeleteItems(UUID principalID, List<UUID> itemIDs)
|
||||||
{
|
{
|
||||||
if (!m_AllowDelete)
|
if (!m_AllowDelete)
|
||||||
return false;
|
{
|
||||||
|
// We must still allow links and links to folders to be deleted, otherwise they will build up
|
||||||
// Just use the ID... *facepalms*
|
// in the player's inventory until they can no longer log in. Deletions of links due to code bugs or
|
||||||
//
|
// similar is inconvenient but on a par with accidental movement of items. The original item is never
|
||||||
foreach (UUID id in itemIDs)
|
// touched.
|
||||||
m_Database.DeleteItems("inventoryID", id.ToString());
|
foreach (UUID id in itemIDs)
|
||||||
|
{
|
||||||
|
if (!m_Database.DeleteItems(
|
||||||
|
new string[] { "inventoryID", "assetType" },
|
||||||
|
new string[] { id.ToString(), ((sbyte)AssetType.Link).ToString() }));
|
||||||
|
{
|
||||||
|
m_Database.DeleteItems(
|
||||||
|
new string[] { "inventoryID", "assetType" },
|
||||||
|
new string[] { id.ToString(), ((sbyte)AssetType.LinkFolder).ToString() });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Just use the ID... *facepalms*
|
||||||
|
//
|
||||||
|
foreach (UUID id in itemIDs)
|
||||||
|
m_Database.DeleteItems("inventoryID", id.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue