Implementing more inventory storage methods.
parent
3676062277
commit
293e70a666
|
@ -36,11 +36,30 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
|
||||||
{
|
{
|
||||||
public override void RequestInventoryForUser(UUID userID, InventoryReceiptCallback callback) {}
|
public override void RequestInventoryForUser(UUID userID, InventoryReceiptCallback callback) {}
|
||||||
|
|
||||||
public InventoryFolderBase GetInventoryFolder(UUID folderID)
|
public InventoryFolderWithChildren GetInventoryFolder(UUID folderID)
|
||||||
|
{
|
||||||
|
InventoryFolderBase baseFolder = null;
|
||||||
|
InventoryFolderWithChildren folder = null;
|
||||||
|
|
||||||
|
foreach (IInventoryDataPlugin plugin in m_plugins)
|
||||||
|
{
|
||||||
|
baseFolder = plugin.getInventoryFolder(folderID);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null != baseFolder)
|
||||||
|
{
|
||||||
|
folder = (InventoryFolderWithChildren) baseFolder;
|
||||||
|
folder.Children = null; // This call only returns data for the folder itself, no children data
|
||||||
|
}
|
||||||
|
|
||||||
|
return folder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public InventoryItemBase GetInventoryItem(UUID itemID)
|
||||||
{
|
{
|
||||||
foreach (IInventoryDataPlugin plugin in m_plugins)
|
foreach (IInventoryDataPlugin plugin in m_plugins)
|
||||||
{
|
{
|
||||||
return plugin.getInventoryFolder(folderID);
|
return plugin.getInventoryItem(itemID);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -120,50 +120,14 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
|
||||||
|
|
||||||
public BackendResponse TryFetchFolder(Uri owner, UUID folderID, out InventoryFolderWithChildren folder)
|
public BackendResponse TryFetchFolder(Uri owner, UUID folderID, out InventoryFolderWithChildren folder)
|
||||||
{
|
{
|
||||||
folder = null;
|
BackendResponse ret;
|
||||||
//BackendResponse ret;
|
|
||||||
|
|
||||||
//using (MySqlConnection dbConnection = new MySqlConnection(m_openSimConfig.GetString("inventory_database_connect")))
|
// TODO: implement some logic for "folder not found"
|
||||||
//{
|
folder = m_inventoryService.GetInventoryFolder(folderID);
|
||||||
// IDataReader reader;
|
ret = BackendResponse.Success;
|
||||||
|
|
||||||
// try
|
m_server.MetricsProvider.LogInventoryFetch(EXTENSION_NAME, ret, owner, folderID, true, DateTime.Now);
|
||||||
// {
|
return ret;
|
||||||
// dbConnection.Open();
|
|
||||||
|
|
||||||
// IDbCommand command = dbConnection.CreateCommand();
|
|
||||||
// command.CommandText = String.Format("SELECT folderName,type,version,agentID,parentFolderID FROM inventoryfolders WHERE folderID='{0}'",
|
|
||||||
// folderID.ToString());
|
|
||||||
// reader = command.ExecuteReader();
|
|
||||||
|
|
||||||
// if (reader.Read())
|
|
||||||
// {
|
|
||||||
// folder = new InventoryFolderWithChildren();
|
|
||||||
// folder.Children = null; // This call only returns data for the folder itself, no children data
|
|
||||||
// folder.ID = folderID;
|
|
||||||
// folder.Name = reader.GetString(0);
|
|
||||||
// folder.Type = reader.GetInt16(1);
|
|
||||||
// folder.Version = (ushort)reader.GetInt16(2);
|
|
||||||
// folder.Owner = UUID.Parse(reader.GetString(3));
|
|
||||||
// folder.ParentID = UUID.Parse(reader.GetString(4));
|
|
||||||
|
|
||||||
// ret = BackendResponse.Success;
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// ret = BackendResponse.NotFound;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// catch (MySqlException ex)
|
|
||||||
// {
|
|
||||||
// m_log.Error("[OPENSIMINVENTORYSTORAGE]: Connection to MySQL backend failed: " + ex.Message);
|
|
||||||
// ret = BackendResponse.Failure;
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
//m_server.MetricsProvider.LogInventoryFetch(EXTENSION_NAME, ret, owner, folderID, true, DateTime.Now);
|
|
||||||
//return ret;
|
|
||||||
return BackendResponse.Success;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public BackendResponse TryFetchFolderContents(Uri owner, UUID folderID, out InventoryCollection contents)
|
public BackendResponse TryFetchFolderContents(Uri owner, UUID folderID, out InventoryCollection contents)
|
||||||
|
@ -268,211 +232,91 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
|
||||||
public BackendResponse TryFetchFolderList(Uri owner, out List<InventoryFolderWithChildren> folders)
|
public BackendResponse TryFetchFolderList(Uri owner, out List<InventoryFolderWithChildren> folders)
|
||||||
{
|
{
|
||||||
folders = null;
|
folders = null;
|
||||||
//BackendResponse ret;
|
BackendResponse ret;
|
||||||
//UUID ownerID;
|
UUID ownerID;
|
||||||
|
|
||||||
//if (Utils.TryGetOpenSimUUID(owner, out ownerID))
|
if (Utils.TryGetOpenSimUUID(owner, out ownerID))
|
||||||
//{
|
{
|
||||||
// using (MySqlConnection dbConnection = new MySqlConnection(m_openSimConfig.GetString("inventory_database_connect")))
|
foreach (InventoryFolderWithChildren baseFolder in m_inventoryService.GetInventorySkeleton(ownerID))
|
||||||
// {
|
{
|
||||||
// IDataReader reader;
|
InventoryFolderWithChildren folder = (InventoryFolderWithChildren) baseFolder;
|
||||||
|
folder.Children = null; // This call does not create a folder hierarchy
|
||||||
|
folders.Add(folder);
|
||||||
|
}
|
||||||
|
|
||||||
// try
|
ret = BackendResponse.Success;
|
||||||
// {
|
}
|
||||||
// dbConnection.Open();
|
else
|
||||||
// folders = new List<InventoryFolderWithChildren>();
|
{
|
||||||
|
ret = BackendResponse.NotFound;
|
||||||
|
}
|
||||||
|
|
||||||
// IDbCommand command = dbConnection.CreateCommand();
|
m_server.MetricsProvider.LogInventoryFetchFolderList(EXTENSION_NAME, ret, owner, DateTime.Now);
|
||||||
// command.CommandText = String.Format("SELECT folderName,type,version,folderID,parentFolderID FROM inventoryfolders WHERE agentID='{0}'",
|
return ret;
|
||||||
// ownerID.ToString());
|
|
||||||
// reader = command.ExecuteReader();
|
|
||||||
|
|
||||||
// while (reader.Read())
|
|
||||||
// {
|
|
||||||
// InventoryFolderWithChildren folder = new InventoryFolderWithChildren();
|
|
||||||
// folder.Owner = ownerID;
|
|
||||||
// folder.Children = null; // This call does not create a folder hierarchy
|
|
||||||
// folder.Name = reader.GetString(0);
|
|
||||||
// folder.Type = reader.GetInt16(1);
|
|
||||||
// folder.Version = (ushort)reader.GetInt16(2);
|
|
||||||
// folder.ID = UUID.Parse(reader.GetString(3));
|
|
||||||
// folder.ParentID = UUID.Parse(reader.GetString(4));
|
|
||||||
|
|
||||||
// folders.Add(folder);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// ret = BackendResponse.Success;
|
|
||||||
// }
|
|
||||||
// catch (MySqlException ex)
|
|
||||||
// {
|
|
||||||
// m_log.Error("[OPENSIMINVENTORYSTORAGE]: Connection to MySQL backend failed: " + ex.Message);
|
|
||||||
// ret = BackendResponse.Failure;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
//else
|
|
||||||
//{
|
|
||||||
// ret = BackendResponse.NotFound;
|
|
||||||
//}
|
|
||||||
|
|
||||||
//m_server.MetricsProvider.LogInventoryFetchFolderList(EXTENSION_NAME, ret, owner, DateTime.Now);
|
|
||||||
//return ret;
|
|
||||||
return BackendResponse.Success;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public BackendResponse TryFetchInventory(Uri owner, out InventoryCollection inventory)
|
public BackendResponse TryFetchInventory(Uri owner, out InventoryCollection inventory)
|
||||||
{
|
{
|
||||||
inventory = null;
|
inventory = null;
|
||||||
//BackendResponse ret;
|
BackendResponse ret;
|
||||||
//List<InventoryFolderWithChildren> folders;
|
List<InventoryFolderWithChildren> folders;
|
||||||
//UUID ownerID;
|
|
||||||
|
|
||||||
//ret = TryFetchFolderList(owner, out folders);
|
ret = TryFetchFolderList(owner, out folders);
|
||||||
|
|
||||||
//if (ret == BackendResponse.Success)
|
if (ret == BackendResponse.Success)
|
||||||
//{
|
{
|
||||||
// // Add the retrieved folders to the inventory collection
|
// Add the retrieved folders to the inventory collection
|
||||||
// inventory = new InventoryCollection();
|
inventory = new InventoryCollection();
|
||||||
// inventory.Folders = new Dictionary<UUID, InventoryFolderWithChildren>(folders.Count);
|
inventory.Folders = new Dictionary<UUID, InventoryFolderWithChildren>(folders.Count);
|
||||||
// foreach (InventoryFolderWithChildren folder in folders)
|
foreach (InventoryFolderWithChildren folder in folders)
|
||||||
// inventory.Folders[folder.ID] = folder;
|
inventory.Folders[folder.ID] = folder;
|
||||||
|
|
||||||
// // Fetch inventory items
|
// Fetch inventory items
|
||||||
// if (Utils.TryGetOpenSimUUID(owner, out ownerID))
|
UUID ownerID;
|
||||||
// {
|
if (Utils.TryGetOpenSimUUID(owner, out ownerID))
|
||||||
// using (MySqlConnection dbConnection = new MySqlConnection(m_openSimConfig.GetString("inventory_database_connect")))
|
{
|
||||||
// {
|
inventory.UserID = ownerID;
|
||||||
// IDataReader reader;
|
inventory.Folders = new Dictionary<UUID, InventoryFolderWithChildren>();
|
||||||
|
|
||||||
// try
|
foreach (InventoryFolderWithChildren folder in folders)
|
||||||
// {
|
{
|
||||||
// dbConnection.Open();
|
foreach (InventoryItemBase item in m_inventoryService.RequestFolderItems(folder.ID))
|
||||||
|
{
|
||||||
|
inventory.Items.Add(item.ID, item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// IDbCommand command = dbConnection.CreateCommand();
|
ret = BackendResponse.Success;
|
||||||
// command.CommandText = String.Format("SELECT assetID,assetType,inventoryName,inventoryDescription,inventoryNextPermissions," +
|
|
||||||
// "inventoryCurrentPermissions,invType,creatorID,inventoryBasePermissions,inventoryEveryOnePermissions,salePrice,saleType," +
|
|
||||||
// "creationDate,groupID,groupOwned,flags,inventoryID,parentFolderID,inventoryGroupPermissions FROM inventoryitems WHERE " +
|
|
||||||
// "avatarID='{0}'", ownerID.ToString());
|
|
||||||
// reader = command.ExecuteReader();
|
|
||||||
|
|
||||||
// inventory.UserID = ownerID;
|
}
|
||||||
// inventory.Items = new Dictionary<UUID, InventoryItemBase>();
|
else
|
||||||
|
{
|
||||||
|
ret = BackendResponse.NotFound;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// while (reader.Read())
|
m_server.MetricsProvider.LogInventoryFetchInventory(EXTENSION_NAME, ret, owner, DateTime.Now);
|
||||||
// {
|
return ret;
|
||||||
// InventoryItemBase item = new InventoryItemBase();
|
|
||||||
// item.Owner = ownerID;
|
|
||||||
// item.AssetID = UUID.Parse(reader.GetString(0));
|
|
||||||
// item.AssetType = reader.GetInt32(1);
|
|
||||||
// item.Name = reader.GetString(2);
|
|
||||||
// item.Description = reader.GetString(3);
|
|
||||||
// item.NextPermissions = (uint)reader.GetInt32(4);
|
|
||||||
// item.CurrentPermissions = (uint)reader.GetInt32(5);
|
|
||||||
// item.InvType = reader.GetInt32(6);
|
|
||||||
// item.Creator = UUID.Parse(reader.GetString(7));
|
|
||||||
// item.BasePermissions = (uint)reader.GetInt32(8);
|
|
||||||
// item.EveryOnePermissions = (uint)reader.GetInt32(9);
|
|
||||||
// item.SalePrice = reader.GetInt32(10);
|
|
||||||
// item.SaleType = reader.GetByte(11);
|
|
||||||
// item.CreationDate = reader.GetInt32(12);
|
|
||||||
// item.GroupID = UUID.Parse(reader.GetString(13));
|
|
||||||
// item.GroupOwned = reader.GetBoolean(14);
|
|
||||||
// item.Flags = (uint)reader.GetInt32(15);
|
|
||||||
// item.ID = UUID.Parse(reader.GetString(16));
|
|
||||||
// item.Folder = UUID.Parse(reader.GetString(17));
|
|
||||||
// item.GroupPermissions = (uint)reader.GetInt32(18);
|
|
||||||
|
|
||||||
// inventory.Items.Add(item.ID, item);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// ret = BackendResponse.Success;
|
|
||||||
// }
|
|
||||||
// catch (MySqlException ex)
|
|
||||||
// {
|
|
||||||
// m_log.Error("[OPENSIMINVENTORYSTORAGE]: Connection to MySQL backend failed: " + ex.Message);
|
|
||||||
// ret = BackendResponse.Failure;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// ret = BackendResponse.NotFound;
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
//m_server.MetricsProvider.LogInventoryFetchInventory(EXTENSION_NAME, ret, owner, DateTime.Now);
|
|
||||||
//return ret;
|
|
||||||
return BackendResponse.Success;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public BackendResponse TryFetchActiveGestures(Uri owner, out List<InventoryItemBase> gestures)
|
public BackendResponse TryFetchActiveGestures(Uri owner, out List<InventoryItemBase> gestures)
|
||||||
{
|
{
|
||||||
gestures = null;
|
gestures = null;
|
||||||
//BackendResponse ret;
|
BackendResponse ret;
|
||||||
//UUID ownerID;
|
UUID ownerID;
|
||||||
|
|
||||||
//if (Utils.TryGetOpenSimUUID(owner, out ownerID))
|
if (Utils.TryGetOpenSimUUID(owner, out ownerID))
|
||||||
//{
|
{
|
||||||
// using (MySqlConnection dbConnection = new MySqlConnection(m_openSimConfig.GetString("inventory_database_connect")))
|
gestures = m_inventoryService.GetActiveGestures(ownerID);
|
||||||
// {
|
ret = BackendResponse.Success;
|
||||||
// IDataReader reader;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ret = BackendResponse.NotFound;
|
||||||
|
}
|
||||||
|
|
||||||
// try
|
m_server.MetricsProvider.LogInventoryFetchActiveGestures(EXTENSION_NAME, ret, owner, DateTime.Now);
|
||||||
// {
|
return ret;
|
||||||
// dbConnection.Open();
|
|
||||||
|
|
||||||
// MySqlCommand command = new MySqlCommand("SELECT assetID,inventoryName,inventoryDescription,inventoryNextPermissions," +
|
|
||||||
// "inventoryCurrentPermissions,invType,creatorID,inventoryBasePermissions,inventoryEveryOnePermissions,salePrice,saleType," +
|
|
||||||
// "creationDate,groupID,groupOwned,inventoryID,parentFolderID,inventoryGroupPermissions FROM inventoryitems WHERE " +
|
|
||||||
// "avatarId=?uuid AND assetType=?type AND flags=1", dbConnection);
|
|
||||||
// command.Parameters.AddWithValue("?uuid", ownerID.ToString());
|
|
||||||
// command.Parameters.AddWithValue("?type", (int)AssetType.Gesture);
|
|
||||||
// reader = command.ExecuteReader();
|
|
||||||
|
|
||||||
// while (reader.Read())
|
|
||||||
// {
|
|
||||||
// InventoryItemBase item = new InventoryItemBase();
|
|
||||||
// item.Owner = ownerID;
|
|
||||||
// item.AssetType = (int)AssetType.Gesture;
|
|
||||||
// item.Flags = (uint)1;
|
|
||||||
// item.AssetID = UUID.Parse(reader.GetString(0));
|
|
||||||
// item.Name = reader.GetString(1);
|
|
||||||
// item.Description = reader.GetString(2);
|
|
||||||
// item.NextPermissions = (uint)reader.GetInt32(3);
|
|
||||||
// item.CurrentPermissions = (uint)reader.GetInt32(4);
|
|
||||||
// item.InvType = reader.GetInt32(5);
|
|
||||||
// item.Creator = UUID.Parse(reader.GetString(6));
|
|
||||||
// item.BasePermissions = (uint)reader.GetInt32(7);
|
|
||||||
// item.EveryOnePermissions = (uint)reader.GetInt32(8);
|
|
||||||
// item.SalePrice = reader.GetInt32(9);
|
|
||||||
// item.SaleType = reader.GetByte(10);
|
|
||||||
// item.CreationDate = reader.GetInt32(11);
|
|
||||||
// item.GroupID = UUID.Parse(reader.GetString(12));
|
|
||||||
// item.GroupOwned = reader.GetBoolean(13);
|
|
||||||
// item.ID = UUID.Parse(reader.GetString(14));
|
|
||||||
// item.Folder = UUID.Parse(reader.GetString(15));
|
|
||||||
// item.GroupPermissions = (uint)reader.GetInt32(16);
|
|
||||||
|
|
||||||
// gestures.Add(item);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// ret = BackendResponse.Success;
|
|
||||||
// }
|
|
||||||
// catch (MySqlException ex)
|
|
||||||
// {
|
|
||||||
// m_log.Error("[OPENSIMINVENTORYSTORAGE]: Connection to MySQL backend failed: " + ex.Message);
|
|
||||||
// ret = BackendResponse.Failure;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
//else
|
|
||||||
//{
|
|
||||||
// ret = BackendResponse.NotFound;
|
|
||||||
//}
|
|
||||||
|
|
||||||
//m_server.MetricsProvider.LogInventoryFetchActiveGestures(EXTENSION_NAME, ret, owner, DateTime.Now);
|
|
||||||
//return ret;
|
|
||||||
return BackendResponse.Success;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public BackendResponse TryCreateItem(Uri owner, InventoryItemBase item)
|
public BackendResponse TryCreateItem(Uri owner, InventoryItemBase item)
|
||||||
|
@ -494,103 +338,60 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
|
||||||
|
|
||||||
public BackendResponse TryCreateFolder(Uri owner, InventoryFolderWithChildren folder)
|
public BackendResponse TryCreateFolder(Uri owner, InventoryFolderWithChildren folder)
|
||||||
{
|
{
|
||||||
//BackendResponse ret;
|
BackendResponse ret;
|
||||||
|
|
||||||
//using (MySqlConnection dbConnection = new MySqlConnection(m_openSimConfig.GetString("inventory_database_connect")))
|
if (m_inventoryService.AddFolder(folder))
|
||||||
//{
|
{
|
||||||
// try
|
ret = BackendResponse.Success;
|
||||||
// {
|
}
|
||||||
// dbConnection.Open();
|
else
|
||||||
|
{
|
||||||
|
ret = BackendResponse.Failure;
|
||||||
|
}
|
||||||
|
|
||||||
// MySqlCommand command = new MySqlCommand(
|
m_server.MetricsProvider.LogInventoryCreate(EXTENSION_NAME, ret, owner, true, DateTime.Now);
|
||||||
// "REPLACE INTO inventoryfolders (folderName,type,version,folderID,agentID,parentFolderID) VALUES " +
|
return ret;
|
||||||
// "(?folderName,?type,?version,?folderID,?agentID,?parentFolderID)", dbConnection);
|
|
||||||
|
|
||||||
// command.Parameters.AddWithValue("?folderName", folder.Name);
|
|
||||||
// command.Parameters.AddWithValue("?type", folder.Type);
|
|
||||||
// command.Parameters.AddWithValue("?version", folder.Version);
|
|
||||||
// command.Parameters.AddWithValue("?folderID", folder.ID);
|
|
||||||
// command.Parameters.AddWithValue("?agentID", folder.Owner);
|
|
||||||
// command.Parameters.AddWithValue("?parentFolderID", folder.ParentID);
|
|
||||||
|
|
||||||
// int rowsAffected = command.ExecuteNonQuery();
|
|
||||||
// if (rowsAffected == 1)
|
|
||||||
// {
|
|
||||||
// ret = BackendResponse.Success;
|
|
||||||
// }
|
|
||||||
// else if (rowsAffected == 2)
|
|
||||||
// {
|
|
||||||
// m_log.Info("[OPENSIMINVENTORYSTORAGE]: Replaced inventory folder " + folder.ID.ToString());
|
|
||||||
// ret = BackendResponse.Success;
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// m_log.ErrorFormat("[OPENSIMINVENTORYSTORAGE]: MySQL REPLACE query affected {0} rows", rowsAffected);
|
|
||||||
// ret = BackendResponse.Failure;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// catch (MySqlException ex)
|
|
||||||
// {
|
|
||||||
// m_log.Error("[OPENSIMINVENTORYSTORAGE]: Connection to MySQL backend failed: " + ex.Message);
|
|
||||||
// ret = BackendResponse.Failure;
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
//m_server.MetricsProvider.LogInventoryCreate(EXTENSION_NAME, ret, owner, true, DateTime.Now);
|
|
||||||
//return ret;
|
|
||||||
return BackendResponse.Success;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public BackendResponse TryCreateInventory(Uri owner, InventoryFolderWithChildren rootFolder)
|
public BackendResponse TryCreateInventory(Uri owner, InventoryFolderWithChildren rootFolder)
|
||||||
{
|
{
|
||||||
return TryCreateFolder(owner, rootFolder);
|
BackendResponse ret;
|
||||||
|
UUID ownerID;
|
||||||
|
|
||||||
|
if (Utils.TryGetOpenSimUUID(owner, out ownerID))
|
||||||
|
{
|
||||||
|
if (m_inventoryService.CreateNewUserInventory(ownerID))
|
||||||
|
{
|
||||||
|
ret = BackendResponse.Success;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ret = BackendResponse.Failure;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ret = BackendResponse.Failure;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BackendResponse TryDeleteItem(Uri owner, UUID itemID)
|
public BackendResponse TryDeleteItem(Uri owner, UUID itemID)
|
||||||
{
|
{
|
||||||
//BackendResponse ret;
|
BackendResponse ret;
|
||||||
//UUID ownerID;
|
|
||||||
|
|
||||||
//if (Utils.TryGetOpenSimUUID(owner, out ownerID))
|
if (m_inventoryService.DeleteItem(m_inventoryService.GetInventoryItem(itemID)))
|
||||||
//{
|
{
|
||||||
// using (MySqlConnection dbConnection = new MySqlConnection(m_openSimConfig.GetString("inventory_database_connect")))
|
ret = BackendResponse.Success;
|
||||||
// {
|
}
|
||||||
// try
|
else
|
||||||
// {
|
{
|
||||||
// dbConnection.Open();
|
ret = BackendResponse.Failure;
|
||||||
|
}
|
||||||
|
|
||||||
// MySqlCommand command = new MySqlCommand(
|
m_server.MetricsProvider.LogInventoryDelete(EXTENSION_NAME, ret, owner, itemID, false, DateTime.Now);
|
||||||
// "DELETE FROM inventoryitems WHERE inventoryID=?inventoryID AND avatarID=?avatarID", dbConnection);
|
return ret;
|
||||||
|
|
||||||
// command.Parameters.AddWithValue("?inventoryID", itemID.ToString());
|
|
||||||
// command.Parameters.AddWithValue("?avatarID", ownerID.ToString());
|
|
||||||
|
|
||||||
// int rowsAffected = command.ExecuteNonQuery();
|
|
||||||
// if (rowsAffected == 1)
|
|
||||||
// {
|
|
||||||
// ret = BackendResponse.Success;
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// m_log.ErrorFormat("[OPENSIMINVENTORYSTORAGE]: MySQL DELETE query affected {0} rows", rowsAffected);
|
|
||||||
// ret = BackendResponse.NotFound;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// catch (MySqlException ex)
|
|
||||||
// {
|
|
||||||
// m_log.Error("[OPENSIMINVENTORYSTORAGE]: Connection to MySQL backend failed: " + ex.Message);
|
|
||||||
// ret = BackendResponse.Failure;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
//else
|
|
||||||
//{
|
|
||||||
// ret = BackendResponse.NotFound;
|
|
||||||
//}
|
|
||||||
|
|
||||||
//m_server.MetricsProvider.LogInventoryDelete(EXTENSION_NAME, ret, owner, itemID, false, DateTime.Now);
|
|
||||||
//return ret;
|
|
||||||
return BackendResponse.Success;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public BackendResponse TryDeleteFolder(Uri owner, UUID folderID)
|
public BackendResponse TryDeleteFolder(Uri owner, UUID folderID)
|
||||||
|
|
Loading…
Reference in New Issue