diff options
author | Justin Clarke Casey | 2009-03-13 20:46:53 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2009-03-13 20:46:53 +0000 |
commit | c04e7cdf2b8f95534dafe7faedb29e1ff1af36c8 (patch) | |
tree | fc5a72b39ba72eee84afba4dc9ff315acbb0096f /OpenSim/Region | |
parent | * Remove asset cache size and texture stat reports from ASSET STATS since the... (diff) | |
download | opensim-SC_OLD-c04e7cdf2b8f95534dafe7faedb29e1ff1af36c8.zip opensim-SC_OLD-c04e7cdf2b8f95534dafe7faedb29e1ff1af36c8.tar.gz opensim-SC_OLD-c04e7cdf2b8f95534dafe7faedb29e1ff1af36c8.tar.bz2 opensim-SC_OLD-c04e7cdf2b8f95534dafe7faedb29e1ff1af36c8.tar.xz |
* Support loading empty folders in an iar
Diffstat (limited to 'OpenSim/Region')
4 files changed, 107 insertions, 85 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index d794f00..4ad9974 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | |||
@@ -200,11 +200,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
200 | TarArchiveReader.TarEntryType entryType; | 200 | TarArchiveReader.TarEntryType entryType; |
201 | while ((data = archive.ReadEntry(out filePath, out entryType)) != null) | 201 | while ((data = archive.ReadEntry(out filePath, out entryType)) != null) |
202 | { | 202 | { |
203 | if (entryType == TarArchiveReader.TarEntryType.TYPE_DIRECTORY) | 203 | if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) |
204 | { | ||
205 | m_log.WarnFormat("[INVENTORY ARCHIVER]: Ignoring directory entry {0}", filePath); | ||
206 | } | ||
207 | else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) | ||
208 | { | 204 | { |
209 | if (LoadAsset(filePath, data)) | 205 | if (LoadAsset(filePath, data)) |
210 | successfulAssetRestores++; | 206 | successfulAssetRestores++; |
@@ -212,24 +208,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
212 | failedAssetRestores++; | 208 | failedAssetRestores++; |
213 | } | 209 | } |
214 | else if (filePath.StartsWith(ArchiveConstants.INVENTORY_PATH)) | 210 | else if (filePath.StartsWith(ArchiveConstants.INVENTORY_PATH)) |
215 | { | 211 | { |
216 | InventoryItemBase item = LoadInvItem(m_asciiEncoding.GetString(data)); | 212 | string fsPath = filePath.Substring(ArchiveConstants.INVENTORY_PATH.Length); |
217 | |||
218 | if (item != null) | ||
219 | { | ||
220 | // Don't use the item ID that's in the file | ||
221 | item.ID = UUID.Random(); | ||
222 | |||
223 | item.Creator = m_userInfo.UserProfile.ID; | ||
224 | item.Owner = m_userInfo.UserProfile.ID; | ||
225 | 213 | ||
226 | string fsPath = filePath.Substring(ArchiveConstants.INVENTORY_PATH.Length); | 214 | // Remove the file portion if we aren't already dealing with a directory path |
215 | if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY != entryType) | ||
227 | fsPath = fsPath.Remove(fsPath.LastIndexOf("/") + 1); | 216 | fsPath = fsPath.Remove(fsPath.LastIndexOf("/") + 1); |
228 | string originalFsPath = fsPath; | 217 | |
218 | string originalFsPath = fsPath; | ||
229 | 219 | ||
230 | m_log.DebugFormat("[INVENTORY ARCHIVER]: Loading to folder {0}", fsPath); | 220 | m_log.DebugFormat("[INVENTORY ARCHIVER]: Loading to folder {0}", fsPath); |
231 | 221 | ||
232 | InventoryFolderImpl foundFolder = null; | 222 | InventoryFolderImpl foundFolder = null; |
223 | |||
224 | // XXX: Nasty way of dealing with a path that has no directory component | ||
225 | if (fsPath.Length > 0) | ||
226 | { | ||
233 | while (null == foundFolder && fsPath.Length > 0) | 227 | while (null == foundFolder && fsPath.Length > 0) |
234 | { | 228 | { |
235 | if (foldersCreated.ContainsKey(fsPath)) | 229 | if (foldersCreated.ContainsKey(fsPath)) |
@@ -256,81 +250,99 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
256 | } | 250 | } |
257 | } | 251 | } |
258 | } | 252 | } |
253 | } | ||
254 | else | ||
255 | { | ||
256 | foundFolder = rootDestinationFolder; | ||
257 | } | ||
259 | 258 | ||
260 | string fsPathSectionToCreate = originalFsPath.Substring(fsPath.Length); | 259 | string fsPathSectionToCreate = originalFsPath.Substring(fsPath.Length); |
261 | string[] rawDirsToCreate | 260 | string[] rawDirsToCreate |
262 | = fsPathSectionToCreate.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); | 261 | = fsPathSectionToCreate.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); |
263 | int i = 0; | 262 | int i = 0; |
264 | 263 | ||
265 | while (i < rawDirsToCreate.Length) | 264 | while (i < rawDirsToCreate.Length) |
266 | { | 265 | { |
267 | m_log.DebugFormat("[INVENTORY ARCHIVER]: Creating folder {0}", rawDirsToCreate[i]); | 266 | m_log.DebugFormat("[INVENTORY ARCHIVER]: Creating folder {0}", rawDirsToCreate[i]); |
268 | 267 | ||
269 | int identicalNameIdentifierIndex | 268 | int identicalNameIdentifierIndex |
270 | = rawDirsToCreate[i].LastIndexOf( | 269 | = rawDirsToCreate[i].LastIndexOf( |
271 | ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR); | 270 | ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR); |
272 | string folderName = rawDirsToCreate[i].Remove(identicalNameIdentifierIndex); | 271 | string folderName = rawDirsToCreate[i].Remove(identicalNameIdentifierIndex); |
273 | 272 | ||
274 | UUID newFolderId = UUID.Random(); | 273 | UUID newFolderId = UUID.Random(); |
275 | m_userInfo.CreateFolder( | 274 | m_userInfo.CreateFolder( |
276 | folderName, newFolderId, (ushort)AssetType.Folder, foundFolder.ID); | 275 | folderName, newFolderId, (ushort)AssetType.Folder, foundFolder.ID); |
277 | foundFolder = foundFolder.GetChildFolder(newFolderId); | 276 | foundFolder = foundFolder.GetChildFolder(newFolderId); |
278 | 277 | ||
279 | // Record that we have now created this folder | 278 | // Record that we have now created this folder |
280 | fsPath += rawDirsToCreate[i] + "/"; | 279 | fsPath += rawDirsToCreate[i] + "/"; |
281 | m_log.DebugFormat("[INVENTORY ARCHIVER]: Recording creation of fs path {0}", fsPath); | 280 | m_log.DebugFormat("[INVENTORY ARCHIVER]: Recording creation of fs path {0}", fsPath); |
282 | foldersCreated[fsPath] = foundFolder; | 281 | foldersCreated[fsPath] = foundFolder; |
283 | 282 | ||
284 | if (0 == i) | 283 | if (0 == i) |
285 | nodesLoaded.Add(foundFolder); | 284 | nodesLoaded.Add(foundFolder); |
286 | 285 | ||
287 | i++; | 286 | i++; |
288 | } | 287 | } |
289 | 288 | ||
290 | /* | 289 | /* |
291 | string[] rawFolders = filePath.Split(new char[] { '/' }); | 290 | string[] rawFolders = filePath.Split(new char[] { '/' }); |
292 | 291 | ||
293 | // Find the folders that do exist along the path given | 292 | // Find the folders that do exist along the path given |
294 | int i = 0; | 293 | int i = 0; |
295 | bool noFolder = false; | 294 | bool noFolder = false; |
296 | InventoryFolderImpl foundFolder = rootDestinationFolder; | 295 | InventoryFolderImpl foundFolder = rootDestinationFolder; |
297 | while (!noFolder && i < rawFolders.Length) | 296 | while (!noFolder && i < rawFolders.Length) |
297 | { | ||
298 | InventoryFolderImpl folder = foundFolder.FindFolderByPath(rawFolders[i]); | ||
299 | if (null != folder) | ||
298 | { | 300 | { |
299 | InventoryFolderImpl folder = foundFolder.FindFolderByPath(rawFolders[i]); | 301 | m_log.DebugFormat("[INVENTORY ARCHIVER]: Found folder {0}", folder.Name); |
300 | if (null != folder) | 302 | foundFolder = folder; |
301 | { | 303 | i++; |
302 | m_log.DebugFormat("[INVENTORY ARCHIVER]: Found folder {0}", folder.Name); | ||
303 | foundFolder = folder; | ||
304 | i++; | ||
305 | } | ||
306 | else | ||
307 | { | ||
308 | noFolder = true; | ||
309 | } | ||
310 | } | 304 | } |
311 | 305 | else | |
312 | // Create any folders that did not previously exist | ||
313 | while (i < rawFolders.Length) | ||
314 | { | 306 | { |
315 | m_log.DebugFormat("[INVENTORY ARCHIVER]: Creating folder {0}", rawFolders[i]); | 307 | noFolder = true; |
316 | |||
317 | UUID newFolderId = UUID.Random(); | ||
318 | m_userInfo.CreateFolder( | ||
319 | rawFolders[i++], newFolderId, (ushort)AssetType.Folder, foundFolder.ID); | ||
320 | foundFolder = foundFolder.GetChildFolder(newFolderId); | ||
321 | } | 308 | } |
322 | */ | 309 | } |
323 | 310 | ||
324 | // Reset folder ID to the one in which we want to load it | 311 | // Create any folders that did not previously exist |
325 | item.Folder = foundFolder.ID; | 312 | while (i < rawFolders.Length) |
313 | { | ||
314 | m_log.DebugFormat("[INVENTORY ARCHIVER]: Creating folder {0}", rawFolders[i]); | ||
326 | 315 | ||
327 | m_userInfo.AddItem(item); | 316 | UUID newFolderId = UUID.Random(); |
328 | successfulItemRestores++; | 317 | m_userInfo.CreateFolder( |
318 | rawFolders[i++], newFolderId, (ushort)AssetType.Folder, foundFolder.ID); | ||
319 | foundFolder = foundFolder.GetChildFolder(newFolderId); | ||
320 | } | ||
321 | */ | ||
329 | 322 | ||
330 | // If we're loading an item directly into the given destination folder then we need to record | 323 | if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY != entryType) |
331 | // it separately from any loaded root folders | 324 | { |
332 | if (rootDestinationFolder == foundFolder) | 325 | InventoryItemBase item = LoadInvItem(m_asciiEncoding.GetString(data)); |
333 | nodesLoaded.Add(item); | 326 | |
327 | if (item != null) | ||
328 | { | ||
329 | // Don't use the item ID that's in the file | ||
330 | item.ID = UUID.Random(); | ||
331 | |||
332 | item.Creator = m_userInfo.UserProfile.ID; | ||
333 | item.Owner = m_userInfo.UserProfile.ID; | ||
334 | |||
335 | // Reset folder ID to the one in which we want to load it | ||
336 | item.Folder = foundFolder.ID; | ||
337 | |||
338 | m_userInfo.AddItem(item); | ||
339 | successfulItemRestores++; | ||
340 | |||
341 | // If we're loading an item directly into the given destination folder then we need to record | ||
342 | // it separately from any loaded root folders | ||
343 | if (rootDestinationFolder == foundFolder) | ||
344 | nodesLoaded.Add(item); | ||
345 | } | ||
334 | } | 346 | } |
335 | } | 347 | } |
336 | } | 348 | } |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs index 076fbce..0a0bb4c 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs | |||
@@ -83,6 +83,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
83 | 83 | ||
84 | protected internal void Execute() | 84 | protected internal void Execute() |
85 | { | 85 | { |
86 | m_log.DebugFormat("[ARCHIVER]: AssetsRequest executed looking for {0} assets", m_repliesRequired); | ||
87 | |||
86 | // We can stop here if there are no assets to fetch | 88 | // We can stop here if there are no assets to fetch |
87 | if (m_repliesRequired == 0) | 89 | if (m_repliesRequired == 0) |
88 | m_assetsRequestCallback(m_assets, m_notFoundAssetUuids); | 90 | m_assetsRequestCallback(m_assets, m_notFoundAssetUuids); |
@@ -100,6 +102,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
100 | /// <param name="asset"></param> | 102 | /// <param name="asset"></param> |
101 | public void AssetRequestCallback(UUID assetID, AssetBase asset) | 103 | public void AssetRequestCallback(UUID assetID, AssetBase asset) |
102 | { | 104 | { |
105 | //m_log.DebugFormat("[ARCHIVER]: Received callback for asset {0}", assetID); | ||
106 | |||
103 | if (asset != null) | 107 | if (asset != null) |
104 | { | 108 | { |
105 | m_assetCache.ExpireAsset(assetID); | 109 | m_assetCache.ExpireAsset(assetID); |
@@ -110,11 +114,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
110 | m_notFoundAssetUuids.Add(assetID); | 114 | m_notFoundAssetUuids.Add(assetID); |
111 | } | 115 | } |
112 | 116 | ||
113 | //m_log.DebugFormat( | ||
114 | // "[ARCHIVER]: Received {0} assets and notification of {1} missing assets", m_assets.Count, m_notFoundAssetUuids.Count); | ||
115 | |||
116 | if (m_assets.Count + m_notFoundAssetUuids.Count == m_repliesRequired) | 117 | if (m_assets.Count + m_notFoundAssetUuids.Count == m_repliesRequired) |
117 | { | 118 | { |
119 | m_log.DebugFormat( | ||
120 | "[ARCHIVER]: Successfully received {0} assets and notification of {1} missing assets", | ||
121 | m_assets.Count, m_notFoundAssetUuids.Count); | ||
122 | |||
118 | // We want to stop using the asset cache thread asap as we now need to do the actual work of producing the archive | 123 | // We want to stop using the asset cache thread asap as we now need to do the actual work of producing the archive |
119 | Thread newThread = new Thread(PerformAssetsRequestCallback); | 124 | Thread newThread = new Thread(PerformAssetsRequestCallback); |
120 | newThread.Name = "OpenSimulator archiving thread post assets receipt"; | 125 | newThread.Name = "OpenSimulator archiving thread post assets receipt"; |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index 7aafaee..f6d0347 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs | |||
@@ -222,6 +222,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
222 | object1PartLoaded.RotationOffset, Is.EqualTo(rotationOffset), "object1 rotation offset not equal"); | 222 | object1PartLoaded.RotationOffset, Is.EqualTo(rotationOffset), "object1 rotation offset not equal"); |
223 | Assert.That( | 223 | Assert.That( |
224 | object1PartLoaded.OffsetPosition, Is.EqualTo(offsetPosition), "object1 offset position not equal"); | 224 | object1PartLoaded.OffsetPosition, Is.EqualTo(offsetPosition), "object1 offset position not equal"); |
225 | |||
226 | // Temporary | ||
227 | Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod()); | ||
225 | } | 228 | } |
226 | 229 | ||
227 | /// <summary> | 230 | /// <summary> |
@@ -304,10 +307,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
304 | Assert.That(object2PartMerged, Is.Not.Null, "object2 was not present after merge"); | 307 | Assert.That(object2PartMerged, Is.Not.Null, "object2 was not present after merge"); |
305 | Assert.That(object2PartMerged.Name, Is.EqualTo(part2Name), "object2 names not identical after merge"); | 308 | Assert.That(object2PartMerged.Name, Is.EqualTo(part2Name), "object2 names not identical after merge"); |
306 | Assert.That(object2PartMerged.GroupPosition, Is.EqualTo(part2GroupPosition), "object2 group position not equal after merge"); | 309 | Assert.That(object2PartMerged.GroupPosition, Is.EqualTo(part2GroupPosition), "object2 group position not equal after merge"); |
307 | } | 310 | } |
308 | |||
309 | // Temporary | ||
310 | Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod()); | ||
311 | } | 311 | } |
312 | } | 312 | } |
313 | } | 313 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 4eb8a28..011d9a6 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -518,6 +518,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
518 | itemCopy.GroupPermissions = item.GroupPermissions & item.NextPermissions; | 518 | itemCopy.GroupPermissions = item.GroupPermissions & item.NextPermissions; |
519 | itemCopy.BasePermissions = item.BasePermissions; | 519 | itemCopy.BasePermissions = item.BasePermissions; |
520 | } | 520 | } |
521 | |||
521 | itemCopy.GroupID = UUID.Zero; | 522 | itemCopy.GroupID = UUID.Zero; |
522 | itemCopy.GroupOwned = false; | 523 | itemCopy.GroupOwned = false; |
523 | itemCopy.Flags = item.Flags; | 524 | itemCopy.Flags = item.Flags; |
@@ -2467,12 +2468,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
2467 | part.NextOwnerMask = item.NextPermissions; | 2468 | part.NextOwnerMask = item.NextPermissions; |
2468 | } | 2469 | } |
2469 | } | 2470 | } |
2471 | |||
2470 | rootPart.TrimPermissions(); | 2472 | rootPart.TrimPermissions(); |
2473 | |||
2471 | if (group.RootPart.Shape.PCode == (byte)PCode.Prim) | 2474 | if (group.RootPart.Shape.PCode == (byte)PCode.Prim) |
2472 | { | 2475 | { |
2473 | group.ClearPartAttachmentData(); | 2476 | group.ClearPartAttachmentData(); |
2474 | } | 2477 | } |
2478 | |||
2475 | group.UpdateGroupRotation(rot); | 2479 | group.UpdateGroupRotation(rot); |
2480 | |||
2476 | //group.ApplyPhysics(m_physicalPrim); | 2481 | //group.ApplyPhysics(m_physicalPrim); |
2477 | if (group.RootPart.PhysActor != null && group.RootPart.PhysActor.IsPhysical && vel != Vector3.Zero) | 2482 | if (group.RootPart.PhysActor != null && group.RootPart.PhysActor.IsPhysical && vel != Vector3.Zero) |
2478 | { | 2483 | { |