* Support loading empty folders in an iar

0.6.5-rc1
Justin Clarke Casey 2009-03-13 20:46:53 +00:00
parent 6573e2ee2f
commit c04e7cdf2b
6 changed files with 115 additions and 94 deletions

View File

@ -65,6 +65,7 @@ namespace OpenSim.Framework
if (m_pqueue.Count > 0)
return m_pqueue.Dequeue();
return m_queue.Dequeue();
}
}

View File

@ -214,9 +214,7 @@ namespace OpenSim.Framework.Communications.Cache
req.IsTexture = isTexture;
m_assetRequests.Enqueue(req);
#if DEBUG
//m_log.InfoFormat("[ASSET SERVER]: Added {0} to request queue", assetID);
#endif
//m_log.DebugFormat("[ASSET SERVER]: Added {0} to request queue", assetID);
}
public virtual void UpdateAsset(AssetBase asset)

View File

@ -200,11 +200,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
TarArchiveReader.TarEntryType entryType;
while ((data = archive.ReadEntry(out filePath, out entryType)) != null)
{
if (entryType == TarArchiveReader.TarEntryType.TYPE_DIRECTORY)
{
m_log.WarnFormat("[INVENTORY ARCHIVER]: Ignoring directory entry {0}", filePath);
}
else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH))
if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH))
{
if (LoadAsset(filePath, data))
successfulAssetRestores++;
@ -213,23 +209,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
}
else if (filePath.StartsWith(ArchiveConstants.INVENTORY_PATH))
{
InventoryItemBase item = LoadInvItem(m_asciiEncoding.GetString(data));
if (item != null)
{
// Don't use the item ID that's in the file
item.ID = UUID.Random();
item.Creator = m_userInfo.UserProfile.ID;
item.Owner = m_userInfo.UserProfile.ID;
string fsPath = filePath.Substring(ArchiveConstants.INVENTORY_PATH.Length);
// Remove the file portion if we aren't already dealing with a directory path
if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY != entryType)
fsPath = fsPath.Remove(fsPath.LastIndexOf("/") + 1);
string originalFsPath = fsPath;
m_log.DebugFormat("[INVENTORY ARCHIVER]: Loading to folder {0}", fsPath);
InventoryFolderImpl foundFolder = null;
// XXX: Nasty way of dealing with a path that has no directory component
if (fsPath.Length > 0)
{
while (null == foundFolder && fsPath.Length > 0)
{
if (foldersCreated.ContainsKey(fsPath))
@ -256,6 +250,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
}
}
}
}
else
{
foundFolder = rootDestinationFolder;
}
string fsPathSectionToCreate = originalFsPath.Substring(fsPath.Length);
string[] rawDirsToCreate
@ -321,6 +320,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
}
*/
if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY != entryType)
{
InventoryItemBase item = LoadInvItem(m_asciiEncoding.GetString(data));
if (item != null)
{
// Don't use the item ID that's in the file
item.ID = UUID.Random();
item.Creator = m_userInfo.UserProfile.ID;
item.Owner = m_userInfo.UserProfile.ID;
// Reset folder ID to the one in which we want to load it
item.Folder = foundFolder.ID;
@ -334,6 +345,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
}
}
}
}
archive.Close();

View File

@ -83,6 +83,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
protected internal void Execute()
{
m_log.DebugFormat("[ARCHIVER]: AssetsRequest executed looking for {0} assets", m_repliesRequired);
// We can stop here if there are no assets to fetch
if (m_repliesRequired == 0)
m_assetsRequestCallback(m_assets, m_notFoundAssetUuids);
@ -100,6 +102,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
/// <param name="asset"></param>
public void AssetRequestCallback(UUID assetID, AssetBase asset)
{
//m_log.DebugFormat("[ARCHIVER]: Received callback for asset {0}", assetID);
if (asset != null)
{
m_assetCache.ExpireAsset(assetID);
@ -110,11 +114,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver
m_notFoundAssetUuids.Add(assetID);
}
//m_log.DebugFormat(
// "[ARCHIVER]: Received {0} assets and notification of {1} missing assets", m_assets.Count, m_notFoundAssetUuids.Count);
if (m_assets.Count + m_notFoundAssetUuids.Count == m_repliesRequired)
{
m_log.DebugFormat(
"[ARCHIVER]: Successfully received {0} assets and notification of {1} missing assets",
m_assets.Count, m_notFoundAssetUuids.Count);
// We want to stop using the asset cache thread asap as we now need to do the actual work of producing the archive
Thread newThread = new Thread(PerformAssetsRequestCallback);
newThread.Name = "OpenSimulator archiving thread post assets receipt";

View File

@ -222,6 +222,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
object1PartLoaded.RotationOffset, Is.EqualTo(rotationOffset), "object1 rotation offset not equal");
Assert.That(
object1PartLoaded.OffsetPosition, Is.EqualTo(offsetPosition), "object1 offset position not equal");
// Temporary
Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod());
}
/// <summary>
@ -305,9 +308,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
Assert.That(object2PartMerged.Name, Is.EqualTo(part2Name), "object2 names not identical after merge");
Assert.That(object2PartMerged.GroupPosition, Is.EqualTo(part2GroupPosition), "object2 group position not equal after merge");
}
// Temporary
Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod());
}
}
}

View File

@ -518,6 +518,7 @@ namespace OpenSim.Region.Framework.Scenes
itemCopy.GroupPermissions = item.GroupPermissions & item.NextPermissions;
itemCopy.BasePermissions = item.BasePermissions;
}
itemCopy.GroupID = UUID.Zero;
itemCopy.GroupOwned = false;
itemCopy.Flags = item.Flags;
@ -2467,12 +2468,16 @@ namespace OpenSim.Region.Framework.Scenes
part.NextOwnerMask = item.NextPermissions;
}
}
rootPart.TrimPermissions();
if (group.RootPart.Shape.PCode == (byte)PCode.Prim)
{
group.ClearPartAttachmentData();
}
group.UpdateGroupRotation(rot);
//group.ApplyPhysics(m_physicalPrim);
if (group.RootPart.PhysActor != null && group.RootPart.PhysActor.IsPhysical && vel != Vector3.Zero)
{