* Actually update subfolders of parent folders in the inventory cache when a folder gets moved
* This was causing inventory folder transfer code to not work properly (this is still temporarily disabled)0.6.1-post-fixes
parent
7c3bfdd8c9
commit
762712c02e
|
@ -397,14 +397,14 @@ namespace OpenSim.Framework.Communications.Cache
|
|||
|
||||
/// <summary>
|
||||
/// Handle a client request to update the inventory folder
|
||||
/// </summary>
|
||||
///
|
||||
/// If the inventory service has not yet delievered the inventory
|
||||
/// for this user then the request will be queued.
|
||||
///
|
||||
/// FIXME: We call add new inventory folder because in the data layer, we happen to use an SQL REPLACE
|
||||
/// so this will work to rename an existing folder. Needless to say, to rely on this is very confusing,
|
||||
/// and needs to be changed.
|
||||
/// </summary>
|
||||
/// and needs to be changed.
|
||||
///
|
||||
/// <param name="folderID"></param>
|
||||
/// <param name="type"></param>
|
||||
|
@ -461,6 +461,10 @@ namespace OpenSim.Framework.Communications.Cache
|
|||
///
|
||||
/// <param name="folderID"></param>
|
||||
/// <param name="parentID"></param>
|
||||
/// <returns>
|
||||
/// true if the delete was successful, or if it was queued pending folder receipt
|
||||
/// false if the folder to be deleted did not exist.
|
||||
/// </returns>
|
||||
public bool MoveFolder(UUID folderID, UUID parentID)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
|
@ -482,10 +486,27 @@ namespace OpenSim.Framework.Communications.Cache
|
|||
{
|
||||
m_commsManager.InventoryService.MoveFolder(baseFolder);
|
||||
}
|
||||
|
||||
|
||||
InventoryFolderImpl folder = RootFolder.FindFolder(folderID);
|
||||
if (folder != null)
|
||||
folder.ParentID = parentID;
|
||||
InventoryFolderImpl parentFolder = RootFolder.FindFolder(parentID);
|
||||
if (parentFolder != null && folder != null)
|
||||
{
|
||||
InventoryFolderImpl oldParentFolder = RootFolder.FindFolder(folder.ParentID);
|
||||
|
||||
if (oldParentFolder != null)
|
||||
{
|
||||
oldParentFolder.RemoveChildFolder(folderID);
|
||||
parentFolder.AddChildFolder(folder);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -502,10 +523,9 @@ namespace OpenSim.Framework.Communications.Cache
|
|||
|
||||
/// <summary>
|
||||
/// This method will delete all the items and folders in the given folder.
|
||||
///
|
||||
/// </summary>
|
||||
/// If the inventory service has not yet delievered the inventory
|
||||
/// for this user then the request will be queued.
|
||||
/// </summary>
|
||||
///
|
||||
/// <param name="folderID"></param>
|
||||
public bool PurgeFolder(UUID folderID)
|
||||
|
|
|
@ -92,6 +92,42 @@ namespace OpenSim.Framework.Communications.Cache
|
|||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add a folder that already exists.
|
||||
/// </summary>
|
||||
/// <param name="folder"></param>
|
||||
public void AddChildFolder(InventoryFolderImpl folder)
|
||||
{
|
||||
lock (SubFolders)
|
||||
{
|
||||
folder.ParentID = ID;
|
||||
SubFolders[folder.ID] = folder;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the given child subfolder.
|
||||
/// </summary>
|
||||
/// <param name="folderID"></param>
|
||||
/// <returns>
|
||||
/// The folder removed, or null if the folder was not present.
|
||||
/// </returns>
|
||||
public InventoryFolderImpl RemoveChildFolder(UUID folderID)
|
||||
{
|
||||
InventoryFolderImpl removedFolder = null;
|
||||
|
||||
lock (SubFolders)
|
||||
{
|
||||
if (SubFolders.ContainsKey(folderID))
|
||||
{
|
||||
removedFolder = SubFolders[folderID];
|
||||
SubFolders.Remove(folderID);
|
||||
}
|
||||
}
|
||||
|
||||
return removedFolder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete all the folders and items in this folder.
|
||||
|
|
|
@ -274,8 +274,8 @@ namespace OpenSim.Framework.Communications.Cache
|
|||
if (!userProfile.MoveFolder(folderID, parentID))
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[AGENT INVENTORY]: Failed to move folder for user {0} {1}",
|
||||
remoteClient.Name, remoteClient.AgentId);
|
||||
"[AGENT INVENTORY]: Failed to move folder {0} to {1} for user {2}",
|
||||
folderID, parentID, remoteClient.Name);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue