* Make it possible to load and save inventory archives while a user is not logged in on standalone mode but not on grid mode

* No user functionality yet
0.6.3-post-fixes
Justin Clarke Casey 2009-02-12 19:54:19 +00:00
parent 5959e42683
commit 9177f28710
3 changed files with 58 additions and 33 deletions

View File

@ -170,14 +170,27 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
int failedAssetRestores = 0;
int successfulItemRestores = 0;
List<InventoryNodeBase> nodesLoaded = new List<InventoryNodeBase>();
if (!m_userInfo.HasReceivedInventory)
{
m_log.ErrorFormat(
"[INVENTORY ARCHIVER]: Have not yet received inventory info for user {0} {1}",
m_userInfo.UserProfile.Name, m_userInfo.UserProfile.ID);
// If the region server has access to the user admin service (by which users are created),
// then we'll assume that it's okay to fiddle with the user's inventory even if they are not on the
// server.
//
// FIXME: FetchInventory should probably be assumed to by async anyway, since even standalones might
// use a remote inventory service, though this is vanishingly rare at the moment.
if (null == commsManager.UserAdminService)
{
m_log.ErrorFormat(
"[INVENTORY ARCHIVER]: Have not yet received inventory info for user {0} {1}",
m_userInfo.UserProfile.Name, m_userInfo.UserProfile.ID);
return nodesLoaded;
return nodesLoaded;
}
else
{
m_userInfo.FetchInventory();
}
}
InventoryFolderImpl inventoryFolder = m_userInfo.RootFolder.FindFolderByPath(m_invPath);

View File

@ -183,42 +183,54 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
InventoryFolderImpl inventoryFolder = null;
InventoryItemBase inventoryItem = null;
if (m_userInfo.HasReceivedInventory)
{
// Eliminate double slashes and any leading / on the path. This might be better done within InventoryFolderImpl
// itself (possibly at a small loss in efficiency).
string[] components
= m_invPath.Split(new string[] { InventoryFolderImpl.PATH_DELIMITER }, StringSplitOptions.RemoveEmptyEntries);
m_invPath = String.Empty;
foreach (string c in components)
if (!m_userInfo.HasReceivedInventory)
{
// If the region server has access to the user admin service (by which users are created),
// then we'll assume that it's okay to fiddle with the user's inventory even if they are not on the
// server.
//
// FIXME: FetchInventory should probably be assumed to by async anyway, since even standalones might
// use a remote inventory service, though this is vanishingly rare at the moment.
if (null == commsManager.UserAdminService)
{
m_invPath += c + InventoryFolderImpl.PATH_DELIMITER;
}
m_log.ErrorFormat(
"[INVENTORY ARCHIVER]: Have not yet received inventory info for user {0} {1}",
m_userInfo.UserProfile.Name, m_userInfo.UserProfile.ID);
// Annoyingly Split actually returns the original string if the input string consists only of delimiters
// Therefore if we still start with a / after the split, then we need the root folder
if (m_invPath.Length == 0)
{
inventoryFolder = m_userInfo.RootFolder;
return;
}
else
{
m_invPath = m_invPath.Remove(m_invPath.LastIndexOf(InventoryFolderImpl.PATH_DELIMITER));
inventoryFolder = m_userInfo.RootFolder.FindFolderByPath(m_invPath);
m_userInfo.FetchInventory();
}
}
// Eliminate double slashes and any leading / on the path. This might be better done within InventoryFolderImpl
// itself (possibly at a small loss in efficiency).
string[] components
= m_invPath.Split(new string[] { InventoryFolderImpl.PATH_DELIMITER }, StringSplitOptions.RemoveEmptyEntries);
m_invPath = String.Empty;
foreach (string c in components)
{
m_invPath += c + InventoryFolderImpl.PATH_DELIMITER;
}
// The path may point to an item instead
if (inventoryFolder == null)
{
inventoryItem = m_userInfo.RootFolder.FindItemByPath(m_invPath);
}
// Annoyingly Split actually returns the original string if the input string consists only of delimiters
// Therefore if we still start with a / after the split, then we need the root folder
if (m_invPath.Length == 0)
{
inventoryFolder = m_userInfo.RootFolder;
}
else
{
m_log.ErrorFormat(
"[INVENTORY ARCHIVER]: Have not yet received inventory info for user {0} {1}",
m_userInfo.UserProfile.Name, m_userInfo.UserProfile.ID);
return;
m_invPath = m_invPath.Remove(m_invPath.LastIndexOf(InventoryFolderImpl.PATH_DELIMITER));
inventoryFolder = m_userInfo.RootFolder.FindFolderByPath(m_invPath);
}
// The path may point to an item instead
if (inventoryFolder == null)
{
inventoryItem = m_userInfo.RootFolder.FindItemByPath(m_invPath);
}
if (null == inventoryFolder)

View File

@ -66,11 +66,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
private CommunicationsManager m_commsManager;
public void Initialise(Scene scene, IConfigSource source)
{
{
if (m_scenes.Count == 0)
{
scene.RegisterModuleInterface<IInventoryArchiverModule>(this);
m_commsManager = scene.CommsManager;
m_commsManager = scene.CommsManager;
scene.AddCommand(
this, "load iar",