* 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 failedAssetRestores = 0;
int successfulItemRestores = 0; int successfulItemRestores = 0;
List<InventoryNodeBase> nodesLoaded = new List<InventoryNodeBase>(); List<InventoryNodeBase> nodesLoaded = new List<InventoryNodeBase>();
if (!m_userInfo.HasReceivedInventory) if (!m_userInfo.HasReceivedInventory)
{ {
m_log.ErrorFormat( // If the region server has access to the user admin service (by which users are created),
"[INVENTORY ARCHIVER]: Have not yet received inventory info for user {0} {1}", // then we'll assume that it's okay to fiddle with the user's inventory even if they are not on the
m_userInfo.UserProfile.Name, m_userInfo.UserProfile.ID); // 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); InventoryFolderImpl inventoryFolder = m_userInfo.RootFolder.FindFolderByPath(m_invPath);

View File

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

View File

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