diff options
author | Melanie | 2010-12-03 02:36:13 +0000 |
---|---|---|
committer | Melanie | 2010-12-03 02:36:13 +0000 |
commit | 342dc532ec64642d5997f23050a9776f663facdf (patch) | |
tree | b0be3997967aa6e4d79873281f535ad436b841e4 /OpenSim/Region/CoreModules | |
parent | Change the way sim health reporting reports sim startup (diff) | |
parent | Only force prim persistence before delete if the prim is the result of an unp... (diff) | |
download | opensim-SC-342dc532ec64642d5997f23050a9776f663facdf.zip opensim-SC-342dc532ec64642d5997f23050a9776f663facdf.tar.gz opensim-SC-342dc532ec64642d5997f23050a9776f663facdf.tar.bz2 opensim-SC-342dc532ec64642d5997f23050a9776f663facdf.tar.xz |
Merge branch 'master' into careminster-presence-refactor
Also prevent god takes from ending up in Lost and Found
Diffstat (limited to 'OpenSim/Region/CoreModules')
11 files changed, 229 insertions, 64 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 046b05f..acf2c3e 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | |||
@@ -37,12 +37,11 @@ using System.Xml.Linq; | |||
37 | using log4net; | 37 | using log4net; |
38 | using OpenMetaverse; | 38 | using OpenMetaverse; |
39 | using OpenSim.Framework; | 39 | using OpenSim.Framework; |
40 | using OpenSim.Framework.Communications; | ||
41 | using OpenSim.Framework.Communications.Osp; | ||
42 | using OpenSim.Framework.Serialization; | 40 | using OpenSim.Framework.Serialization; |
43 | using OpenSim.Framework.Serialization.External; | 41 | using OpenSim.Framework.Serialization.External; |
44 | using OpenSim.Region.CoreModules.World.Archiver; | 42 | using OpenSim.Region.CoreModules.World.Archiver; |
45 | using OpenSim.Region.Framework.Scenes; | 43 | using OpenSim.Region.Framework.Scenes; |
44 | using OpenSim.Region.Framework.Interfaces; | ||
46 | using OpenSim.Services.Interfaces; | 45 | using OpenSim.Services.Interfaces; |
47 | 46 | ||
48 | namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | 47 | namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver |
@@ -398,20 +397,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
398 | // Don't use the item ID that's in the file | 397 | // Don't use the item ID that's in the file |
399 | item.ID = UUID.Random(); | 398 | item.ID = UUID.Random(); |
400 | 399 | ||
401 | UUID ospResolvedId = OspResolver.ResolveOspa(item.CreatorId, m_scene.UserAccountService); | 400 | UUID ospResolvedId = OspResolver.ResolveOspa(item.CreatorId, m_scene.UserAccountService); |
402 | if (UUID.Zero != ospResolvedId) | 401 | if (UUID.Zero != ospResolvedId) // The user exists in this grid |
403 | { | 402 | { |
404 | item.CreatorIdAsUuid = ospResolvedId; | 403 | item.CreatorIdAsUuid = ospResolvedId; |
405 | 404 | ||
406 | // XXX: For now, don't preserve the OSPA in the creator id (which actually gets persisted to the | 405 | // XXX: For now, don't preserve the OSPA in the creator id (which actually gets persisted to the |
407 | // database). Instead, replace with the UUID that we found. | 406 | // database). Instead, replace with the UUID that we found. |
408 | item.CreatorId = ospResolvedId.ToString(); | 407 | item.CreatorId = ospResolvedId.ToString(); |
408 | |||
409 | item.CreatorData = string.Empty; | ||
409 | } | 410 | } |
410 | else | 411 | else if (item.CreatorData == null || item.CreatorData == String.Empty) |
411 | { | 412 | { |
412 | item.CreatorIdAsUuid = m_userInfo.PrincipalID; | 413 | item.CreatorIdAsUuid = m_userInfo.PrincipalID; |
413 | } | 414 | } |
414 | 415 | ||
415 | item.Owner = m_userInfo.PrincipalID; | 416 | item.Owner = m_userInfo.PrincipalID; |
416 | 417 | ||
417 | // Reset folder ID to the one in which we want to load it | 418 | // Reset folder ID to the one in which we want to load it |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs index d81703a..cab341d 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs | |||
@@ -36,8 +36,6 @@ using OpenMetaverse; | |||
36 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
37 | using OpenSim.Framework.Serialization; | 37 | using OpenSim.Framework.Serialization; |
38 | using OpenSim.Framework.Serialization.External; | 38 | using OpenSim.Framework.Serialization.External; |
39 | using OpenSim.Framework.Communications; | ||
40 | using OpenSim.Framework.Communications.Osp; | ||
41 | using OpenSim.Region.CoreModules.World.Archiver; | 39 | using OpenSim.Region.CoreModules.World.Archiver; |
42 | using OpenSim.Region.Framework.Scenes; | 40 | using OpenSim.Region.Framework.Scenes; |
43 | using OpenSim.Services.Interfaces; | 41 | using OpenSim.Services.Interfaces; |
@@ -139,20 +137,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
139 | m_id, succeeded, m_userInfo, m_invPath, m_saveStream, reportedException); | 137 | m_id, succeeded, m_userInfo, m_invPath, m_saveStream, reportedException); |
140 | } | 138 | } |
141 | 139 | ||
142 | protected void SaveInvItem(InventoryItemBase inventoryItem, string path) | 140 | protected void SaveInvItem(InventoryItemBase inventoryItem, string path, Dictionary<string, object> options, IUserAccountService userAccountService) |
143 | { | 141 | { |
144 | string filename = path + CreateArchiveItemName(inventoryItem); | 142 | string filename = path + CreateArchiveItemName(inventoryItem); |
145 | 143 | ||
146 | // Record the creator of this item for user record purposes (which might go away soon) | 144 | // Record the creator of this item for user record purposes (which might go away soon) |
147 | m_userUuids[inventoryItem.CreatorIdAsUuid] = 1; | 145 | m_userUuids[inventoryItem.CreatorIdAsUuid] = 1; |
148 | 146 | ||
149 | InventoryItemBase saveItem = (InventoryItemBase)inventoryItem.Clone(); | 147 | string serialization = UserInventoryItemSerializer.Serialize(inventoryItem, options, userAccountService); |
150 | saveItem.CreatorId = OspResolver.MakeOspa(saveItem.CreatorIdAsUuid, m_scene.UserAccountService); | ||
151 | |||
152 | string serialization = UserInventoryItemSerializer.Serialize(saveItem); | ||
153 | m_archiveWriter.WriteFile(filename, serialization); | 148 | m_archiveWriter.WriteFile(filename, serialization); |
154 | 149 | ||
155 | m_assetGatherer.GatherAssetUuids(saveItem.AssetID, (AssetType)saveItem.AssetType, m_assetUuids); | 150 | m_assetGatherer.GatherAssetUuids(inventoryItem.AssetID, (AssetType)inventoryItem.AssetType, m_assetUuids); |
156 | } | 151 | } |
157 | 152 | ||
158 | /// <summary> | 153 | /// <summary> |
@@ -161,7 +156,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
161 | /// <param name="inventoryFolder">The inventory folder to save</param> | 156 | /// <param name="inventoryFolder">The inventory folder to save</param> |
162 | /// <param name="path">The path to which the folder should be saved</param> | 157 | /// <param name="path">The path to which the folder should be saved</param> |
163 | /// <param name="saveThisFolderItself">If true, save this folder itself. If false, only saves contents</param> | 158 | /// <param name="saveThisFolderItself">If true, save this folder itself. If false, only saves contents</param> |
164 | protected void SaveInvFolder(InventoryFolderBase inventoryFolder, string path, bool saveThisFolderItself) | 159 | protected void SaveInvFolder(InventoryFolderBase inventoryFolder, string path, bool saveThisFolderItself, Dictionary<string, object> options, IUserAccountService userAccountService) |
165 | { | 160 | { |
166 | if (saveThisFolderItself) | 161 | if (saveThisFolderItself) |
167 | { | 162 | { |
@@ -176,19 +171,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
176 | 171 | ||
177 | foreach (InventoryFolderBase childFolder in contents.Folders) | 172 | foreach (InventoryFolderBase childFolder in contents.Folders) |
178 | { | 173 | { |
179 | SaveInvFolder(childFolder, path, true); | 174 | SaveInvFolder(childFolder, path, true, options, userAccountService); |
180 | } | 175 | } |
181 | 176 | ||
182 | foreach (InventoryItemBase item in contents.Items) | 177 | foreach (InventoryItemBase item in contents.Items) |
183 | { | 178 | { |
184 | SaveInvItem(item, path); | 179 | SaveInvItem(item, path, options, userAccountService); |
185 | } | 180 | } |
186 | } | 181 | } |
187 | 182 | ||
188 | /// <summary> | 183 | /// <summary> |
189 | /// Execute the inventory write request | 184 | /// Execute the inventory write request |
190 | /// </summary> | 185 | /// </summary> |
191 | public void Execute() | 186 | public void Execute(Dictionary<string, object> options, IUserAccountService userAccountService) |
192 | { | 187 | { |
193 | try | 188 | try |
194 | { | 189 | { |
@@ -266,7 +261,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
266 | m_invPath == String.Empty ? InventoryFolderImpl.PATH_DELIMITER : m_invPath); | 261 | m_invPath == String.Empty ? InventoryFolderImpl.PATH_DELIMITER : m_invPath); |
267 | 262 | ||
268 | //recurse through all dirs getting dirs and files | 263 | //recurse through all dirs getting dirs and files |
269 | SaveInvFolder(inventoryFolder, ArchiveConstants.INVENTORY_PATH, !saveFolderContentsOnly); | 264 | SaveInvFolder(inventoryFolder, ArchiveConstants.INVENTORY_PATH, !saveFolderContentsOnly, options, userAccountService); |
270 | } | 265 | } |
271 | else if (inventoryItem != null) | 266 | else if (inventoryItem != null) |
272 | { | 267 | { |
@@ -274,14 +269,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
274 | "[INVENTORY ARCHIVER]: Found item {0} {1} at {2}", | 269 | "[INVENTORY ARCHIVER]: Found item {0} {1} at {2}", |
275 | inventoryItem.Name, inventoryItem.ID, m_invPath); | 270 | inventoryItem.Name, inventoryItem.ID, m_invPath); |
276 | 271 | ||
277 | SaveInvItem(inventoryItem, ArchiveConstants.INVENTORY_PATH); | 272 | SaveInvItem(inventoryItem, ArchiveConstants.INVENTORY_PATH, options, userAccountService); |
278 | } | 273 | } |
279 | 274 | ||
280 | // Don't put all this profile information into the archive right now. | 275 | // Don't put all this profile information into the archive right now. |
281 | //SaveUsers(); | 276 | //SaveUsers(); |
282 | 277 | ||
283 | new AssetsRequest( | 278 | new AssetsRequest( |
284 | new AssetsArchiver(m_archiveWriter), m_assetUuids, m_scene.AssetService, ReceivedAllAssets).Execute(); | 279 | new AssetsArchiver(m_archiveWriter), |
280 | m_assetUuids, m_scene.AssetService, | ||
281 | m_scene.UserAccountService, m_scene.RegionInfo.ScopeID, | ||
282 | options, ReceivedAllAssets).Execute(); | ||
285 | } | 283 | } |
286 | catch (Exception) | 284 | catch (Exception) |
287 | { | 285 | { |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index 2eaca49..b33c2b1 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs | |||
@@ -75,6 +75,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
75 | private Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>(); | 75 | private Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>(); |
76 | private Scene m_aScene; | 76 | private Scene m_aScene; |
77 | 77 | ||
78 | private IUserAccountService m_UserAccountService; | ||
79 | protected IUserAccountService UserAccountService | ||
80 | { | ||
81 | get | ||
82 | { | ||
83 | if (m_UserAccountService == null) | ||
84 | // What a strange thing to do... | ||
85 | foreach (Scene s in m_scenes.Values) | ||
86 | { | ||
87 | m_UserAccountService = s.RequestModuleInterface<IUserAccountService>(); | ||
88 | break; | ||
89 | } | ||
90 | |||
91 | return m_UserAccountService; | ||
92 | } | ||
93 | } | ||
94 | |||
95 | |||
78 | public InventoryArchiverModule() {} | 96 | public InventoryArchiverModule() {} |
79 | 97 | ||
80 | public InventoryArchiverModule(bool disablePresenceChecks) | 98 | public InventoryArchiverModule(bool disablePresenceChecks) |
@@ -106,11 +124,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
106 | 124 | ||
107 | scene.AddCommand( | 125 | scene.AddCommand( |
108 | this, "save iar", | 126 | this, "save iar", |
109 | "save iar <first> <last> <inventory path> <password> [<IAR path>]", | 127 | "save iar <first> <last> <inventory path> <password> [--p|-profile=<url>] [<IAR path>]", |
110 | "Save user inventory archive (IAR).", | 128 | "Save user inventory archive (IAR).", |
111 | "<first> is the user's first name." + Environment.NewLine | 129 | "<first> is the user's first name." + Environment.NewLine |
112 | + "<last> is the user's last name." + Environment.NewLine | 130 | + "<last> is the user's last name." + Environment.NewLine |
113 | + "<inventory path> is the path inside the user's inventory for the folder/item to be saved." + Environment.NewLine | 131 | + "<inventory path> is the path inside the user's inventory for the folder/item to be saved." + Environment.NewLine |
132 | + "-p|--profile=<url> adds the url of the profile service to the saved user information." + Environment.NewLine | ||
114 | + "<IAR path> is the filesystem path at which to save the IAR." | 133 | + "<IAR path> is the filesystem path at which to save the IAR." |
115 | + string.Format(" If this is not given then the filename {0} in the current directory is used", DEFAULT_INV_BACKUP_FILENAME), | 134 | + string.Format(" If this is not given then the filename {0} in the current directory is used", DEFAULT_INV_BACKUP_FILENAME), |
116 | HandleSaveInvConsoleCommand); | 135 | HandleSaveInvConsoleCommand); |
@@ -157,7 +176,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
157 | { | 176 | { |
158 | try | 177 | try |
159 | { | 178 | { |
160 | new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, saveStream).Execute(); | 179 | new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, saveStream).Execute(options, UserAccountService); |
161 | } | 180 | } |
162 | catch (EntryPointNotFoundException e) | 181 | catch (EntryPointNotFoundException e) |
163 | { | 182 | { |
@@ -197,7 +216,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
197 | { | 216 | { |
198 | try | 217 | try |
199 | { | 218 | { |
200 | new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, savePath).Execute(); | 219 | new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, savePath).Execute(options, UserAccountService); |
201 | } | 220 | } |
202 | catch (EntryPointNotFoundException e) | 221 | catch (EntryPointNotFoundException e) |
203 | { | 222 | { |
@@ -235,14 +254,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
235 | if (m_scenes.Count > 0) | 254 | if (m_scenes.Count > 0) |
236 | { | 255 | { |
237 | UserAccount userInfo = GetUserInfo(firstName, lastName, pass); | 256 | UserAccount userInfo = GetUserInfo(firstName, lastName, pass); |
238 | 257 | ||
239 | if (userInfo != null) | 258 | if (userInfo != null) |
240 | { | 259 | { |
241 | if (CheckPresence(userInfo.PrincipalID)) | 260 | if (CheckPresence(userInfo.PrincipalID)) |
242 | { | 261 | { |
262 | |||
243 | InventoryArchiveReadRequest request; | 263 | InventoryArchiveReadRequest request; |
244 | bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false); | 264 | bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false); |
245 | 265 | ||
246 | try | 266 | try |
247 | { | 267 | { |
248 | request = new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadStream, merge); | 268 | request = new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadStream, merge); |
@@ -256,7 +276,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
256 | 276 | ||
257 | return false; | 277 | return false; |
258 | } | 278 | } |
259 | 279 | ||
260 | UpdateClientWithLoadedNodes(userInfo, request.Execute()); | 280 | UpdateClientWithLoadedNodes(userInfo, request.Execute()); |
261 | 281 | ||
262 | return true; | 282 | return true; |
@@ -268,6 +288,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
268 | userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID); | 288 | userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID); |
269 | } | 289 | } |
270 | } | 290 | } |
291 | else | ||
292 | m_log.ErrorFormat("[INVENTORY ARCHIVER]: User {0} {1} not found", | ||
293 | firstName, lastName); | ||
271 | } | 294 | } |
272 | 295 | ||
273 | return false; | 296 | return false; |
@@ -368,10 +391,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
368 | protected void HandleSaveInvConsoleCommand(string module, string[] cmdparams) | 391 | protected void HandleSaveInvConsoleCommand(string module, string[] cmdparams) |
369 | { | 392 | { |
370 | Guid id = Guid.NewGuid(); | 393 | Guid id = Guid.NewGuid(); |
371 | 394 | ||
395 | Dictionary<string, object> options = new Dictionary<string, object>(); | ||
396 | |||
397 | OptionSet ops = new OptionSet(); | ||
398 | //ops.Add("v|version=", delegate(string v) { options["version"] = v; }); | ||
399 | ops.Add("p|profile=", delegate(string v) { options["profile"] = v; }); | ||
400 | |||
401 | List<string> mainParams = ops.Parse(cmdparams); | ||
402 | |||
372 | try | 403 | try |
373 | { | 404 | { |
374 | if (cmdparams.Length < 6) | 405 | if (mainParams.Count < 6) |
375 | { | 406 | { |
376 | m_log.Error( | 407 | m_log.Error( |
377 | "[INVENTORY ARCHIVER]: usage is save iar <first name> <last name> <inventory path> <user password> [<save file path>]"); | 408 | "[INVENTORY ARCHIVER]: usage is save iar <first name> <last name> <inventory path> <user password> [<save file path>]"); |
@@ -379,18 +410,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
379 | } | 410 | } |
380 | 411 | ||
381 | m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME."); | 412 | m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME."); |
382 | 413 | if (options.ContainsKey("profile")) | |
383 | string firstName = cmdparams[2]; | 414 | m_log.WarnFormat("[INVENTORY ARCHIVER]: Please be aware that inventory archives with creator information are not compatible with OpenSim 0.7.0.2 and earlier. Do not use the -profile option if you want to produce a compatible IAR"); |
384 | string lastName = cmdparams[3]; | 415 | |
385 | string invPath = cmdparams[4]; | 416 | string firstName = mainParams[2]; |
386 | string pass = cmdparams[5]; | 417 | string lastName = mainParams[3]; |
387 | string savePath = (cmdparams.Length > 6 ? cmdparams[6] : DEFAULT_INV_BACKUP_FILENAME); | 418 | string invPath = mainParams[4]; |
419 | string pass = mainParams[5]; | ||
420 | string savePath = (mainParams.Count > 6 ? mainParams[6] : DEFAULT_INV_BACKUP_FILENAME); | ||
388 | 421 | ||
389 | m_log.InfoFormat( | 422 | m_log.InfoFormat( |
390 | "[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}", | 423 | "[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}", |
391 | savePath, invPath, firstName, lastName); | 424 | savePath, invPath, firstName, lastName); |
392 | 425 | ||
393 | ArchiveInventory(id, firstName, lastName, invPath, pass, savePath, new Dictionary<string, object>()); | 426 | ArchiveInventory(id, firstName, lastName, invPath, pass, savePath, options); |
394 | } | 427 | } |
395 | catch (InventoryArchiverException e) | 428 | catch (InventoryArchiverException e) |
396 | { | 429 | { |
@@ -518,5 +551,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
518 | 551 | ||
519 | return false; | 552 | return false; |
520 | } | 553 | } |
554 | |||
521 | } | 555 | } |
522 | } | 556 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 938886b2..2747e15 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | |||
@@ -38,7 +38,6 @@ using OpenSim.Framework; | |||
38 | using OpenSim.Framework.Serialization; | 38 | using OpenSim.Framework.Serialization; |
39 | using OpenSim.Framework.Serialization.External; | 39 | using OpenSim.Framework.Serialization.External; |
40 | using OpenSim.Framework.Communications; | 40 | using OpenSim.Framework.Communications; |
41 | using OpenSim.Framework.Communications.Osp; | ||
42 | using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver; | 41 | using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver; |
43 | using OpenSim.Region.CoreModules.World.Serialiser; | 42 | using OpenSim.Region.CoreModules.World.Serialiser; |
44 | using OpenSim.Region.Framework.Scenes; | 43 | using OpenSim.Region.Framework.Scenes; |
@@ -96,14 +95,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
96 | item1.Name = m_item1Name; | 95 | item1.Name = m_item1Name; |
97 | item1.AssetID = UUID.Random(); | 96 | item1.AssetID = UUID.Random(); |
98 | item1.GroupID = UUID.Random(); | 97 | item1.GroupID = UUID.Random(); |
99 | item1.CreatorId = OspResolver.MakeOspa(m_ua2.FirstName, m_ua2.LastName); | 98 | //item1.CreatorId = OspResolver.MakeOspa(m_ua2.FirstName, m_ua2.LastName); |
100 | //item1.CreatorId = userUuid.ToString(); | 99 | //item1.CreatorId = userUuid.ToString(); |
101 | //item1.CreatorId = "00000000-0000-0000-0000-000000000444"; | 100 | item1.CreatorId = m_ua2.PrincipalID.ToString(); |
102 | item1.Owner = UUID.Zero; | 101 | item1.Owner = UUID.Zero; |
103 | 102 | ||
103 | Scene scene = SceneSetupHelpers.SetupScene("Inventory"); | ||
104 | UserProfileTestUtils.CreateUserWithInventory(scene, m_ua2, "hampshire"); | ||
105 | |||
104 | string item1FileName | 106 | string item1FileName |
105 | = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName); | 107 | = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName); |
106 | tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1)); | 108 | tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1, new Dictionary<string, object>(), scene.UserAccountService)); |
107 | tar.Close(); | 109 | tar.Close(); |
108 | m_iarStream = new MemoryStream(archiveWriteStream.ToArray()); | 110 | m_iarStream = new MemoryStream(archiveWriteStream.ToArray()); |
109 | } | 111 | } |
@@ -386,7 +388,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
386 | Scene scene = SceneSetupHelpers.SetupScene("inventory"); | 388 | Scene scene = SceneSetupHelpers.SetupScene("inventory"); |
387 | 389 | ||
388 | SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); | 390 | SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); |
389 | 391 | ||
390 | UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "meowfood"); | 392 | UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "meowfood"); |
391 | UserProfileTestUtils.CreateUserWithInventory(scene, m_ua2, "hampshire"); | 393 | UserProfileTestUtils.CreateUserWithInventory(scene, m_ua2, "hampshire"); |
392 | 394 | ||
@@ -551,7 +553,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
551 | 553 | ||
552 | string item1FileName | 554 | string item1FileName |
553 | = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName); | 555 | = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName); |
554 | tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1)); | 556 | tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1, new Dictionary<string,object>(), null)); |
555 | tar.Close(); | 557 | tar.Close(); |
556 | 558 | ||
557 | MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); | 559 | MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs index ccb892e..81b65c5 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs | |||
@@ -27,8 +27,11 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.IO; | ||
30 | using System.Reflection; | 31 | using System.Reflection; |
31 | using System.Threading; | 32 | using System.Threading; |
33 | using System.Xml; | ||
34 | |||
32 | using log4net; | 35 | using log4net; |
33 | using OpenMetaverse; | 36 | using OpenMetaverse; |
34 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
@@ -52,14 +55,16 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
52 | // private Dictionary<string, InventoryClient> m_inventoryServers = new Dictionary<string, InventoryClient>(); | 55 | // private Dictionary<string, InventoryClient> m_inventoryServers = new Dictionary<string, InventoryClient>(); |
53 | 56 | ||
54 | private Scene m_scene; | 57 | private Scene m_scene; |
58 | private string m_ProfileServerURI; | ||
55 | 59 | ||
56 | #endregion | 60 | #endregion |
57 | 61 | ||
58 | #region Constructor | 62 | #region Constructor |
59 | 63 | ||
60 | public HGAssetMapper(Scene scene) | 64 | public HGAssetMapper(Scene scene, string profileURL) |
61 | { | 65 | { |
62 | m_scene = scene; | 66 | m_scene = scene; |
67 | m_ProfileServerURI = profileURL; | ||
63 | } | 68 | } |
64 | 69 | ||
65 | #endregion | 70 | #endregion |
@@ -95,16 +100,18 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
95 | try | 100 | try |
96 | { | 101 | { |
97 | asset1.ID = url + "/" + asset.ID; | 102 | asset1.ID = url + "/" + asset.ID; |
98 | // UUID temp = UUID.Zero; | ||
99 | // TODO: if the creator is local, stick this grid's URL in front | ||
100 | //if (UUID.TryParse(asset.Metadata.CreatorID, out temp)) | ||
101 | // asset1.Metadata.CreatorID = ??? + "/" + asset.Metadata.CreatorID; | ||
102 | } | 103 | } |
103 | catch | 104 | catch |
104 | { | 105 | { |
105 | m_log.Warn("[HG ASSET MAPPER]: Oops."); | 106 | m_log.Warn("[HG ASSET MAPPER]: Oops."); |
106 | } | 107 | } |
107 | 108 | ||
109 | AdjustIdentifiers(asset1.Metadata); | ||
110 | if (asset1.Metadata.Type == (sbyte)AssetType.Object) | ||
111 | asset1.Data = AdjustIdentifiers(asset.Data); | ||
112 | else | ||
113 | asset1.Data = asset.Data; | ||
114 | |||
108 | m_scene.AssetService.Store(asset1); | 115 | m_scene.AssetService.Store(asset1); |
109 | m_log.DebugFormat("[HG ASSET MAPPER]: Posted copy of asset {0} from local asset server to {1}", asset1.ID, url); | 116 | m_log.DebugFormat("[HG ASSET MAPPER]: Posted copy of asset {0} from local asset server to {1}", asset1.ID, url); |
110 | } | 117 | } |
@@ -118,7 +125,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
118 | 125 | ||
119 | private void Copy(AssetBase from, AssetBase to) | 126 | private void Copy(AssetBase from, AssetBase to) |
120 | { | 127 | { |
121 | to.Data = from.Data; | 128 | //to.Data = from.Data; // don't copy this, it's copied elsewhere |
122 | to.Description = from.Description; | 129 | to.Description = from.Description; |
123 | to.FullID = from.FullID; | 130 | to.FullID = from.FullID; |
124 | to.ID = from.ID; | 131 | to.ID = from.ID; |
@@ -129,6 +136,70 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
129 | 136 | ||
130 | } | 137 | } |
131 | 138 | ||
139 | private void AdjustIdentifiers(AssetMetadata meta) | ||
140 | { | ||
141 | if (meta.CreatorID != null && meta.CreatorID != string.Empty) | ||
142 | { | ||
143 | UUID uuid = UUID.Zero; | ||
144 | UUID.TryParse(meta.CreatorID, out uuid); | ||
145 | UserAccount creator = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, uuid); | ||
146 | if (creator != null) | ||
147 | meta.CreatorID = m_ProfileServerURI + "/" + meta.CreatorID + ";" + creator.FirstName + " " + creator.LastName; | ||
148 | } | ||
149 | } | ||
150 | |||
151 | protected byte[] AdjustIdentifiers(byte[] data) | ||
152 | { | ||
153 | string xml = Utils.BytesToString(data); | ||
154 | return Utils.StringToBytes(RewriteSOP(xml)); | ||
155 | } | ||
156 | |||
157 | protected string RewriteSOP(string xml) | ||
158 | { | ||
159 | XmlDocument doc = new XmlDocument(); | ||
160 | doc.LoadXml(xml); | ||
161 | XmlNodeList sops = doc.GetElementsByTagName("SceneObjectPart"); | ||
162 | |||
163 | foreach (XmlNode sop in sops) | ||
164 | { | ||
165 | UserAccount creator = null; | ||
166 | bool hasCreatorData = false; | ||
167 | XmlNodeList nodes = sop.ChildNodes; | ||
168 | foreach (XmlNode node in nodes) | ||
169 | { | ||
170 | if (node.Name == "CreatorID") | ||
171 | { | ||
172 | UUID uuid = UUID.Zero; | ||
173 | UUID.TryParse(node.InnerText, out uuid); | ||
174 | creator = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, uuid); | ||
175 | } | ||
176 | if (node.Name == "CreatorData" && node.InnerText != null && node.InnerText != string.Empty) | ||
177 | hasCreatorData = true; | ||
178 | |||
179 | //if (node.Name == "OwnerID") | ||
180 | //{ | ||
181 | // UserAccount owner = GetUser(node.InnerText); | ||
182 | // if (owner != null) | ||
183 | // node.InnerText = m_ProfileServiceURL + "/" + node.InnerText + "/" + owner.FirstName + " " + owner.LastName; | ||
184 | //} | ||
185 | } | ||
186 | |||
187 | if (!hasCreatorData && creator != null) | ||
188 | { | ||
189 | XmlElement creatorData = doc.CreateElement("CreatorData"); | ||
190 | creatorData.InnerText = m_ProfileServerURI + "/" + creator.PrincipalID + ";" + creator.FirstName + " " + creator.LastName; | ||
191 | sop.AppendChild(creatorData); | ||
192 | } | ||
193 | } | ||
194 | |||
195 | using (StringWriter wr = new StringWriter()) | ||
196 | { | ||
197 | doc.Save(wr); | ||
198 | return wr.ToString(); | ||
199 | } | ||
200 | |||
201 | } | ||
202 | |||
132 | // TODO: unused | 203 | // TODO: unused |
133 | // private void Dump(Dictionary<UUID, bool> lst) | 204 | // private void Dump(Dictionary<UUID, bool> lst) |
134 | // { | 205 | // { |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs index 125a397..34b8114 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs | |||
@@ -54,6 +54,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
54 | get { return m_assMapper; } | 54 | get { return m_assMapper; } |
55 | } | 55 | } |
56 | 56 | ||
57 | private string m_ProfileServerURI; | ||
58 | |||
57 | // private bool m_Initialized = false; | 59 | // private bool m_Initialized = false; |
58 | 60 | ||
59 | #region INonSharedRegionModule | 61 | #region INonSharedRegionModule |
@@ -73,6 +75,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
73 | { | 75 | { |
74 | m_Enabled = true; | 76 | m_Enabled = true; |
75 | m_log.InfoFormat("[HG INVENTORY ACCESS MODULE]: {0} enabled.", Name); | 77 | m_log.InfoFormat("[HG INVENTORY ACCESS MODULE]: {0} enabled.", Name); |
78 | |||
79 | IConfig thisModuleConfig = source.Configs["HGInventoryAccessModule"]; | ||
80 | if (thisModuleConfig != null) | ||
81 | m_ProfileServerURI = thisModuleConfig.GetString("ProfileServerURI", string.Empty); | ||
82 | else | ||
83 | m_log.Warn("[HG INVENTORY ACCESS MODULE]: HGInventoryAccessModule configs not found. ProfileServerURI not set!"); | ||
76 | } | 84 | } |
77 | } | 85 | } |
78 | } | 86 | } |
@@ -83,7 +91,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
83 | return; | 91 | return; |
84 | 92 | ||
85 | base.AddRegion(scene); | 93 | base.AddRegion(scene); |
86 | m_assMapper = new HGAssetMapper(scene); | 94 | m_assMapper = new HGAssetMapper(scene, m_ProfileServerURI); |
87 | scene.EventManager.OnNewInventoryItemUploadComplete += UploadInventoryItem; | 95 | scene.EventManager.OnNewInventoryItemUploadComplete += UploadInventoryItem; |
88 | 96 | ||
89 | } | 97 | } |
@@ -97,7 +105,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
97 | string userAssetServer = string.Empty; | 105 | string userAssetServer = string.Empty; |
98 | if (IsForeignUser(avatarID, out userAssetServer)) | 106 | if (IsForeignUser(avatarID, out userAssetServer)) |
99 | { | 107 | { |
100 | m_assMapper.Post(assetID, avatarID, userAssetServer); | 108 | Util.FireAndForget(delegate { m_assMapper.Post(assetID, avatarID, userAssetServer); }); |
101 | } | 109 | } |
102 | } | 110 | } |
103 | 111 | ||
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 22da665..623cd3a 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -54,6 +54,17 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
54 | 54 | ||
55 | protected bool m_Enabled = false; | 55 | protected bool m_Enabled = false; |
56 | protected Scene m_Scene; | 56 | protected Scene m_Scene; |
57 | protected IUserManagement m_UserManagement; | ||
58 | protected IUserManagement UserManagementModule | ||
59 | { | ||
60 | get | ||
61 | { | ||
62 | if (m_UserManagement == null) | ||
63 | m_UserManagement = m_Scene.RequestModuleInterface<IUserManagement>(); | ||
64 | return m_UserManagement; | ||
65 | } | ||
66 | } | ||
67 | |||
57 | 68 | ||
58 | #region INonSharedRegionModule | 69 | #region INonSharedRegionModule |
59 | 70 | ||
@@ -416,7 +427,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
416 | // | 427 | // |
417 | if (action == DeRezAction.Take || action == DeRezAction.TakeCopy) | 428 | if (action == DeRezAction.Take || action == DeRezAction.TakeCopy) |
418 | { | 429 | { |
419 | if (objlist[0].RootPart.FromFolderID != UUID.Zero) | 430 | if (objlist[0].RootPart.FromFolderID != UUID.Zero && objlist[0].OwnerID == remoteClient.AgentId) |
420 | { | 431 | { |
421 | InventoryFolderBase f = new InventoryFolderBase(objlist[0].RootPart.FromFolderID, userID); | 432 | InventoryFolderBase f = new InventoryFolderBase(objlist[0].RootPart.FromFolderID, userID); |
422 | folder = m_Scene.InventoryService.GetFolder(f); | 433 | folder = m_Scene.InventoryService.GetFolder(f); |
@@ -863,6 +874,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
863 | return null; | 874 | return null; |
864 | } | 875 | } |
865 | 876 | ||
877 | protected void AddUserData(SceneObjectGroup sog) | ||
878 | { | ||
879 | UserManagementModule.AddUser(sog.RootPart.CreatorID, sog.RootPart.CreatorData); | ||
880 | foreach (SceneObjectPart sop in sog.Parts) | ||
881 | UserManagementModule.AddUser(sop.CreatorID, sop.CreatorData); | ||
882 | } | ||
883 | |||
866 | public virtual void TransferInventoryAssets(InventoryItemBase item, UUID sender, UUID receiver) | 884 | public virtual void TransferInventoryAssets(InventoryItemBase item, UUID sender, UUID receiver) |
867 | { | 885 | { |
868 | } | 886 | } |
@@ -943,9 +961,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
943 | protected virtual InventoryItemBase GetItem(UUID agentID, UUID itemID) | 961 | protected virtual InventoryItemBase GetItem(UUID agentID, UUID itemID) |
944 | { | 962 | { |
945 | IInventoryService invService = m_Scene.RequestModuleInterface<IInventoryService>(); | 963 | IInventoryService invService = m_Scene.RequestModuleInterface<IInventoryService>(); |
946 | InventoryItemBase assetRequestItem = new InventoryItemBase(itemID, agentID); | 964 | InventoryItemBase item = new InventoryItemBase(itemID, agentID); |
947 | assetRequestItem = invService.GetItem(assetRequestItem); | 965 | item = invService.GetItem(item); |
948 | return assetRequestItem; | 966 | |
967 | if (item.CreatorData != null && item.CreatorData != string.Empty) | ||
968 | UserManagementModule.AddUser(item.CreatorIdAsUuid, item.CreatorData); | ||
969 | |||
970 | return item; | ||
949 | } | 971 | } |
950 | 972 | ||
951 | #endregion | 973 | #endregion |
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs index 0d94baa..bf84100 100644 --- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs +++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs | |||
@@ -275,6 +275,11 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
275 | m_log.DebugFormat("[USER MANAGEMENT MODULE]: Added user {0} {1} {2} {3}", user.Id, user.FirstName, user.LastName, user.ProfileURL); | 275 | m_log.DebugFormat("[USER MANAGEMENT MODULE]: Added user {0} {1} {2} {3}", user.Id, user.FirstName, user.LastName, user.ProfileURL); |
276 | } | 276 | } |
277 | 277 | ||
278 | public void AddUser(UUID uuid, string first, string last, string profileURL) | ||
279 | { | ||
280 | AddUser(uuid, profileURL + ";" + first + " " + last); | ||
281 | } | ||
282 | |||
278 | //public void AddUser(UUID uuid, string userData) | 283 | //public void AddUser(UUID uuid, string userData) |
279 | //{ | 284 | //{ |
280 | // if (m_UserCache.ContainsKey(uuid)) | 285 | // if (m_UserCache.ContainsKey(uuid)) |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Asset/AssetServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Asset/AssetServiceInConnectorModule.cs index 2324380..e25700d 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Asset/AssetServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Asset/AssetServiceInConnectorModule.cs | |||
@@ -91,9 +91,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Asset | |||
91 | { | 91 | { |
92 | m_Registered = true; | 92 | m_Registered = true; |
93 | 93 | ||
94 | m_log.Info("[RegionAssetService]: Starting..."); | 94 | m_log.Info("[HGAssetService]: Starting..."); |
95 | 95 | ||
96 | Object[] args = new Object[] { m_Config, MainServer.Instance, string.Empty }; | 96 | |
97 | Object[] args = new Object[] { m_Config, MainServer.Instance, "HGAssetService" }; | ||
97 | 98 | ||
98 | ServerUtils.LoadPlugin<IServiceConnector>("OpenSim.Server.Handlers.dll:AssetServiceConnector", args); | 99 | ServerUtils.LoadPlugin<IServiceConnector>("OpenSim.Server.Handlers.dll:AssetServiceConnector", args); |
99 | } | 100 | } |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs index b987b5a..0699407 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs | |||
@@ -190,7 +190,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
190 | 190 | ||
191 | new AssetsRequest( | 191 | new AssetsRequest( |
192 | new AssetsArchiver(archiveWriter), assetUuids, | 192 | new AssetsArchiver(archiveWriter), assetUuids, |
193 | m_scene.AssetService, awre.ReceivedAllAssets).Execute(); | 193 | m_scene.AssetService, m_scene.UserAccountService, |
194 | m_scene.RegionInfo.ScopeID, options, awre.ReceivedAllAssets).Execute(); | ||
194 | } | 195 | } |
195 | catch (Exception) | 196 | catch (Exception) |
196 | { | 197 | { |
@@ -238,10 +239,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
238 | } | 239 | } |
239 | 240 | ||
240 | m_log.InfoFormat("[ARCHIVER]: Creating version {0}.{1} OAR", majorVersion, minorVersion); | 241 | m_log.InfoFormat("[ARCHIVER]: Creating version {0}.{1} OAR", majorVersion, minorVersion); |
241 | if (majorVersion == 1) | 242 | //if (majorVersion == 1) |
242 | { | 243 | //{ |
243 | m_log.WarnFormat("[ARCHIVER]: Please be aware that version 1.0 OARs are not compatible with OpenSim 0.7.0.2 and earlier. Please use the --version=0 option if you want to produce a compatible OAR"); | 244 | // m_log.WarnFormat("[ARCHIVER]: Please be aware that version 1.0 OARs are not compatible with OpenSim 0.7.0.2 and earlier. Please use the --version=0 option if you want to produce a compatible OAR"); |
244 | } | 245 | //} |
245 | 246 | ||
246 | StringWriter sw = new StringWriter(); | 247 | StringWriter sw = new StringWriter(); |
247 | XmlTextWriter xtw = new XmlTextWriter(sw); | 248 | XmlTextWriter xtw = new XmlTextWriter(sw); |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs index d4a09b4..5da1656 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs | |||
@@ -34,6 +34,7 @@ using log4net; | |||
34 | using OpenMetaverse; | 34 | using OpenMetaverse; |
35 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
36 | using OpenSim.Framework.Serialization; | 36 | using OpenSim.Framework.Serialization; |
37 | using OpenSim.Framework.Serialization.External; | ||
37 | using OpenSim.Services.Interfaces; | 38 | using OpenSim.Services.Interfaces; |
38 | 39 | ||
39 | namespace OpenSim.Region.CoreModules.World.Archiver | 40 | namespace OpenSim.Region.CoreModules.World.Archiver |
@@ -100,17 +101,26 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
100 | /// Asset service used to request the assets | 101 | /// Asset service used to request the assets |
101 | /// </value> | 102 | /// </value> |
102 | protected IAssetService m_assetService; | 103 | protected IAssetService m_assetService; |
104 | protected IUserAccountService m_userAccountService; | ||
105 | protected UUID m_scopeID; // the grid ID | ||
103 | 106 | ||
104 | protected AssetsArchiver m_assetsArchiver; | 107 | protected AssetsArchiver m_assetsArchiver; |
105 | 108 | ||
109 | protected Dictionary<string, object> m_options; | ||
110 | |||
106 | protected internal AssetsRequest( | 111 | protected internal AssetsRequest( |
107 | AssetsArchiver assetsArchiver, IDictionary<UUID, AssetType> uuids, | 112 | AssetsArchiver assetsArchiver, IDictionary<UUID, AssetType> uuids, |
108 | IAssetService assetService, AssetsRequestCallback assetsRequestCallback) | 113 | IAssetService assetService, IUserAccountService userService, |
114 | UUID scope, Dictionary<string, object> options, | ||
115 | AssetsRequestCallback assetsRequestCallback) | ||
109 | { | 116 | { |
110 | m_assetsArchiver = assetsArchiver; | 117 | m_assetsArchiver = assetsArchiver; |
111 | m_uuids = uuids; | 118 | m_uuids = uuids; |
112 | m_assetsRequestCallback = assetsRequestCallback; | 119 | m_assetsRequestCallback = assetsRequestCallback; |
113 | m_assetService = assetService; | 120 | m_assetService = assetService; |
121 | m_userAccountService = userService; | ||
122 | m_scopeID = scope; | ||
123 | m_options = options; | ||
114 | m_repliesRequired = uuids.Count; | 124 | m_repliesRequired = uuids.Count; |
115 | 125 | ||
116 | m_requestCallbackTimer = new System.Timers.Timer(TIMEOUT); | 126 | m_requestCallbackTimer = new System.Timers.Timer(TIMEOUT); |
@@ -241,7 +251,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
241 | { | 251 | { |
242 | // m_log.DebugFormat("[ARCHIVER]: Writing asset {0}", id); | 252 | // m_log.DebugFormat("[ARCHIVER]: Writing asset {0}", id); |
243 | m_foundAssetUuids.Add(asset.FullID); | 253 | m_foundAssetUuids.Add(asset.FullID); |
244 | m_assetsArchiver.WriteAsset(asset); | 254 | |
255 | m_assetsArchiver.WriteAsset(PostProcess(asset)); | ||
245 | } | 256 | } |
246 | else | 257 | else |
247 | { | 258 | { |
@@ -288,5 +299,16 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
288 | "[ARCHIVER]: Terminating archive creation since asset requster callback failed with {0}", e); | 299 | "[ARCHIVER]: Terminating archive creation since asset requster callback failed with {0}", e); |
289 | } | 300 | } |
290 | } | 301 | } |
302 | |||
303 | protected AssetBase PostProcess(AssetBase asset) | ||
304 | { | ||
305 | if (asset.Type == (sbyte)AssetType.Object && asset.Data != null && m_options.ContainsKey("profile")) | ||
306 | { | ||
307 | //m_log.DebugFormat("[ARCHIVER]: Rewriting object data for {0}", asset.ID); | ||
308 | string xml = ExternalRepresentationUtils.RewriteSOP(Utils.BytesToString(asset.Data), m_options["profile"].ToString(), m_userAccountService, m_scopeID); | ||
309 | asset.Data = Utils.StringToBytes(xml); | ||
310 | } | ||
311 | return asset; | ||
312 | } | ||
291 | } | 313 | } |
292 | } | 314 | } |