* Implement proper emptying of trashcan on standalone
* On standalone, folders (and their items) should now be persistently deleted on trash emptying, as well as immediate child items * An implementation for grid mode will follow.0.6.0-stable
parent
2a3bdde0fa
commit
4db839c3b8
|
@ -637,7 +637,7 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Delete an inventory folder
|
/// Deletes an inventory folder
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="folderId">Id of folder to delete</param>
|
/// <param name="folderId">Id of folder to delete</param>
|
||||||
public void deleteInventoryFolder(LLUUID folderID)
|
public void deleteInventoryFolder(LLUUID folderID)
|
||||||
|
|
|
@ -79,14 +79,12 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Delete all the folders and items in this folder.
|
/// Delete all the folders and items in this folder.
|
||||||
///
|
|
||||||
/// TODO: This method is not used yet, but will be shortly
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void DeleteAllContents()
|
public void Purge()
|
||||||
{
|
{
|
||||||
foreach (InventoryFolderImpl folder in SubFolders.Values)
|
foreach (InventoryFolderImpl folder in SubFolders.Values)
|
||||||
{
|
{
|
||||||
folder.DeleteAllContents();
|
folder.Purge();
|
||||||
}
|
}
|
||||||
|
|
||||||
SubFolders.Clear();
|
SubFolders.Clear();
|
||||||
|
@ -206,7 +204,7 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Return the list of folders in this folder
|
/// Return the list of immediate child folders in this folder.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<InventoryFolderBase> RequestListOfFolders()
|
public List<InventoryFolderBase> RequestListOfFolders()
|
||||||
{
|
{
|
||||||
|
|
|
@ -496,6 +496,11 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
return new List<InventoryItemBase>();
|
return new List<InventoryItemBase>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This should delete all the items and folders in the given directory.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="remoteClient"></param>
|
||||||
|
/// <param name="folderID"></param>
|
||||||
public void HandlePurgeInventoryDescendents(IClientAPI remoteClient, LLUUID folderID)
|
public void HandlePurgeInventoryDescendents(IClientAPI remoteClient, LLUUID folderID)
|
||||||
{
|
{
|
||||||
// m_log.InfoFormat("[AGENT INVENTORY]: Purging folder {0} for {1} uuid {2}",
|
// m_log.InfoFormat("[AGENT INVENTORY]: Purging folder {0} for {1} uuid {2}",
|
||||||
|
@ -506,14 +511,28 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
{
|
{
|
||||||
if (userProfile.HasInventory)
|
if (userProfile.HasInventory)
|
||||||
{
|
{
|
||||||
InventoryFolderImpl subFolder = userProfile.RootFolder.HasSubFolder(folderID);
|
InventoryFolderImpl purgedFolder = userProfile.RootFolder.HasSubFolder(folderID);
|
||||||
if (subFolder != null)
|
if (purgedFolder != null)
|
||||||
{
|
{
|
||||||
List<InventoryItemBase> items = subFolder.RequestListOfItems();
|
// XXX Nasty - have to create a new object to hold details we already have
|
||||||
|
InventoryFolderBase purgedBaseFolder = new InventoryFolderBase();
|
||||||
|
purgedBaseFolder.Owner = purgedFolder.Owner;
|
||||||
|
purgedBaseFolder.ID = purgedFolder.ID;
|
||||||
|
purgedBaseFolder.Name = purgedFolder.Name;
|
||||||
|
purgedBaseFolder.ParentID = purgedFolder.ParentID;
|
||||||
|
purgedBaseFolder.Type = purgedFolder.Type;
|
||||||
|
purgedBaseFolder.Version = purgedFolder.Version;
|
||||||
|
|
||||||
|
m_commsManager.InventoryService.PurgeInventoryFolder(remoteClient.AgentId, purgedBaseFolder);
|
||||||
|
|
||||||
|
// XXX Remains temporarily so that we still delete items in the grid case.
|
||||||
|
List<InventoryItemBase> items = purgedFolder.RequestListOfItems();
|
||||||
foreach (InventoryItemBase item in items)
|
foreach (InventoryItemBase item in items)
|
||||||
{
|
{
|
||||||
userProfile.DeleteItem(remoteClient.AgentId, item);
|
userProfile.DeleteItem(remoteClient.AgentId, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
purgedFolder.Purge();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -56,8 +56,20 @@ namespace OpenSim.Framework.Communications
|
||||||
/// <param name="folder"></param>
|
/// <param name="folder"></param>
|
||||||
void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder);
|
void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Move an inventory folder to a new location
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userID"></param>
|
||||||
|
/// <param name="folder">A folder containing the details of the new location</param>
|
||||||
void MoveInventoryFolder(LLUUID userID, InventoryFolderBase folder);
|
void MoveInventoryFolder(LLUUID userID, InventoryFolderBase folder);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Purge an inventory folder of all its items and subfolders.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userID"></param>
|
||||||
|
/// <param name="folder"></param>
|
||||||
|
void PurgeInventoryFolder(LLUUID userID, InventoryFolderBase folder);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add a new item to the given user's inventory
|
/// Add a new item to the given user's inventory
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -50,7 +50,7 @@ namespace OpenSim.Framework.Communications
|
||||||
{
|
{
|
||||||
if (!String.IsNullOrEmpty(FileName))
|
if (!String.IsNullOrEmpty(FileName))
|
||||||
{
|
{
|
||||||
m_log.Info("[AGENTINVENTORY]: Inventory storage: Attempting to load " + FileName);
|
m_log.Info("[AGENT INVENTORY]: Inventory storage: Attempting to load " + FileName);
|
||||||
Assembly pluginAssembly = Assembly.LoadFrom(FileName);
|
Assembly pluginAssembly = Assembly.LoadFrom(FileName);
|
||||||
|
|
||||||
foreach (Type pluginType in pluginAssembly.GetTypes())
|
foreach (Type pluginType in pluginAssembly.GetTypes())
|
||||||
|
@ -161,9 +161,19 @@ namespace OpenSim.Framework.Communications
|
||||||
// See IInventoryServices
|
// See IInventoryServices
|
||||||
public abstract void RequestInventoryForUser(LLUUID userID, InventoryReceiptCallback callback);
|
public abstract void RequestInventoryForUser(LLUUID userID, InventoryReceiptCallback callback);
|
||||||
|
|
||||||
|
// See IInventoryServices
|
||||||
public abstract void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder);
|
public abstract void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder);
|
||||||
|
|
||||||
|
// See IInventoryServices
|
||||||
public abstract void MoveExistingInventoryFolder(InventoryFolderBase folder);
|
public abstract void MoveExistingInventoryFolder(InventoryFolderBase folder);
|
||||||
|
|
||||||
|
// See IInventoryServices
|
||||||
|
public abstract void PurgeInventoryFolder(LLUUID userID, InventoryFolderBase folder);
|
||||||
|
|
||||||
|
// See IInventoryServices
|
||||||
public abstract void AddNewInventoryItem(LLUUID userID, InventoryItemBase item);
|
public abstract void AddNewInventoryItem(LLUUID userID, InventoryItemBase item);
|
||||||
|
|
||||||
|
// See IInventoryServices
|
||||||
public abstract void DeleteInventoryItem(LLUUID userID, InventoryItemBase item);
|
public abstract void DeleteInventoryItem(LLUUID userID, InventoryItemBase item);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -228,6 +238,36 @@ namespace OpenSim.Framework.Communications
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Purge a folder of all items items and subfolders.
|
||||||
|
///
|
||||||
|
/// FIXME: Really nasty in a sense, because we have to query the database to get information we may
|
||||||
|
/// already know... Needs heavy refactoring.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="folder"></param>
|
||||||
|
protected void PurgeFolder(InventoryFolderBase folder)
|
||||||
|
{
|
||||||
|
List<InventoryFolderBase> subFolders = RequestSubFolders(folder.ID);
|
||||||
|
|
||||||
|
foreach (InventoryFolderBase subFolder in subFolders)
|
||||||
|
{
|
||||||
|
// m_log.DebugFormat("[AGENT INVENTORY]: Deleting folder {0} {1}", subFolder.Name, subFolder.ID);
|
||||||
|
|
||||||
|
foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
|
||||||
|
{
|
||||||
|
plugin.Value.deleteInventoryFolder(subFolder.ID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// XXX Temporarily don't delete the items since UserProfileCacheService is still doing this
|
||||||
|
// List<InventoryItemBase> items = RequestFolderItems(folder.ID);
|
||||||
|
//
|
||||||
|
// foreach (InventoryItemBase item : items)
|
||||||
|
// {
|
||||||
|
// DeleteItem(item);
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
private void AddNewInventorySet(UsersInventory inventory)
|
private void AddNewInventorySet(UsersInventory inventory)
|
||||||
{
|
{
|
||||||
foreach (InventoryFolderBase folder in inventory.Folders.Values)
|
foreach (InventoryFolderBase folder in inventory.Folders.Values)
|
||||||
|
@ -236,6 +276,9 @@ namespace OpenSim.Framework.Communications
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Used to create a new user inventory.
|
||||||
|
/// </summary>
|
||||||
private class UsersInventory
|
private class UsersInventory
|
||||||
{
|
{
|
||||||
public Dictionary<LLUUID, InventoryFolderBase> Folders = new Dictionary<LLUUID, InventoryFolderBase>();
|
public Dictionary<LLUUID, InventoryFolderBase> Folders = new Dictionary<LLUUID, InventoryFolderBase>();
|
||||||
|
|
|
@ -144,7 +144,7 @@ namespace OpenSim.Framework
|
||||||
void moveInventoryFolder(InventoryFolderBase folder);
|
void moveInventoryFolder(InventoryFolderBase folder);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Deletes a folder based on its ID with folder
|
/// Deletes a folder. Thie will delete both the folder itself and its contents (items and descendent folders)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="folder">The id of the folder</param>
|
/// <param name="folder">The id of the folder</param>
|
||||||
void deleteInventoryFolder(LLUUID folder);
|
void deleteInventoryFolder(LLUUID folder);
|
||||||
|
|
|
@ -108,8 +108,6 @@ namespace OpenSim.Framework
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public int InvType {
|
public int InvType {
|
||||||
get {
|
get {
|
||||||
return _invType;
|
return _invType;
|
||||||
|
|
|
@ -220,6 +220,16 @@ namespace OpenSim.Grid.InventoryServer
|
||||||
MoveExistingInventoryFolder(folder);
|
MoveExistingInventoryFolder(folder);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userID"></param>
|
||||||
|
/// <param name="folder"></param>
|
||||||
|
public override void PurgeInventoryFolder(LLUUID userID, InventoryFolderBase folder)
|
||||||
|
{
|
||||||
|
// XXX No implementation yet (temporarily)!
|
||||||
|
}
|
||||||
|
|
||||||
public bool AddInventoryItem(InventoryItemBase item)
|
public bool AddInventoryItem(InventoryItemBase item)
|
||||||
{
|
{
|
||||||
|
|
|
@ -100,6 +100,16 @@ namespace OpenSim.Region.Communications.Local
|
||||||
DeleteItem(item);
|
DeleteItem(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userID"></param>
|
||||||
|
/// <param name="folder"></param>
|
||||||
|
public override void PurgeInventoryFolder(LLUUID userID, InventoryFolderBase folder)
|
||||||
|
{
|
||||||
|
PurgeFolder(folder);
|
||||||
|
}
|
||||||
|
|
||||||
public override bool HasInventoryForUser(LLUUID userID)
|
public override bool HasInventoryForUser(LLUUID userID)
|
||||||
{
|
{
|
||||||
InventoryFolderBase root = RequestRootFolder(userID);
|
InventoryFolderBase root = RequestRootFolder(userID);
|
||||||
|
|
|
@ -175,6 +175,16 @@ namespace OpenSim.Region.Communications.OGS1
|
||||||
e.Source, e.Message);
|
e.Source, e.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userID"></param>
|
||||||
|
/// <param name="folder"></param>
|
||||||
|
public void PurgeInventoryFolder(LLUUID userID, InventoryFolderBase folder)
|
||||||
|
{
|
||||||
|
// XXX No implementation yet (temporarily)!
|
||||||
|
}
|
||||||
|
|
||||||
public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item)
|
public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue