diff options
author | AliciaRaven | 2014-09-06 20:23:40 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-09-23 00:04:53 +0100 |
commit | 5bc3bbbcf3e7df23db3e3e0410266ba72a1a1e14 (patch) | |
tree | 810e7e39cb5dfa5ee77f40f3c1ae3eae2a9175fd /OpenSim/Region/CoreModules | |
parent | Change existing IAR save to use UUID for its callback reference instead of Gu... (diff) | |
download | opensim-SC_OLD-5bc3bbbcf3e7df23db3e3e0410266ba72a1a1e14.zip opensim-SC_OLD-5bc3bbbcf3e7df23db3e3e0410266ba72a1a1e14.tar.gz opensim-SC_OLD-5bc3bbbcf3e7df23db3e3e0410266ba72a1a1e14.tar.bz2 opensim-SC_OLD-5bc3bbbcf3e7df23db3e3e0410266ba72a1a1e14.tar.xz |
Add an event callback for loading IAR files. The callback for creating them already existed but not for loading. This is of interest for use by region modules. Also includes reporting numbers of items saved and items filtered to the completed log printout.
Diffstat (limited to 'OpenSim/Region/CoreModules')
8 files changed, 135 insertions, 47 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 9963521..2730b3f 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | |||
@@ -61,6 +61,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
61 | 61 | ||
62 | private UserAccount m_userInfo; | 62 | private UserAccount m_userInfo; |
63 | private string m_invPath; | 63 | private string m_invPath; |
64 | |||
65 | /// <value> | ||
66 | /// ID of this request | ||
67 | /// </value> | ||
68 | protected UUID m_id; | ||
64 | 69 | ||
65 | /// <summary> | 70 | /// <summary> |
66 | /// Do we want to merge this load with existing inventory? | 71 | /// Do we want to merge this load with existing inventory? |
@@ -71,6 +76,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
71 | protected IAssetService m_AssetService; | 76 | protected IAssetService m_AssetService; |
72 | protected IUserAccountService m_UserAccountService; | 77 | protected IUserAccountService m_UserAccountService; |
73 | 78 | ||
79 | private InventoryArchiverModule m_module; | ||
80 | |||
74 | /// <value> | 81 | /// <value> |
75 | /// The stream from which the inventory archive will be loaded. | 82 | /// The stream from which the inventory archive will be loaded. |
76 | /// </value> | 83 | /// </value> |
@@ -117,9 +124,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
117 | protected Dictionary<UUID, UUID> m_creatorIdForAssetId = new Dictionary<UUID, UUID>(); | 124 | protected Dictionary<UUID, UUID> m_creatorIdForAssetId = new Dictionary<UUID, UUID>(); |
118 | 125 | ||
119 | public InventoryArchiveReadRequest( | 126 | public InventoryArchiveReadRequest( |
120 | IInventoryService inv, IAssetService assets, IUserAccountService uacc, UserAccount userInfo, string invPath, string loadPath, bool merge) | 127 | UUID id, IInventoryService inv, InventoryArchiverModule module, IAssetService assets, IUserAccountService uacc, UserAccount userInfo, string invPath, string loadPath, bool merge) |
121 | : this( | 128 | : this( |
129 | id, | ||
122 | inv, | 130 | inv, |
131 | module, | ||
123 | assets, | 132 | assets, |
124 | uacc, | 133 | uacc, |
125 | userInfo, | 134 | userInfo, |
@@ -130,8 +139,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
130 | } | 139 | } |
131 | 140 | ||
132 | public InventoryArchiveReadRequest( | 141 | public InventoryArchiveReadRequest( |
133 | IInventoryService inv, IAssetService assets, IUserAccountService uacc, UserAccount userInfo, string invPath, Stream loadStream, bool merge) | 142 | UUID id, IInventoryService inv, InventoryArchiverModule module, IAssetService assets, IUserAccountService uacc, UserAccount userInfo, string invPath, Stream loadStream, bool merge) |
134 | { | 143 | { |
144 | m_id = id; | ||
135 | m_InventoryService = inv; | 145 | m_InventoryService = inv; |
136 | m_AssetService = assets; | 146 | m_AssetService = assets; |
137 | m_UserAccountService = uacc; | 147 | m_UserAccountService = uacc; |
@@ -139,6 +149,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
139 | m_userInfo = userInfo; | 149 | m_userInfo = userInfo; |
140 | m_invPath = invPath; | 150 | m_invPath = invPath; |
141 | m_loadStream = loadStream; | 151 | m_loadStream = loadStream; |
152 | m_module = module; | ||
142 | 153 | ||
143 | // FIXME: Do not perform this check since older versions of OpenSim do save the control file after other things | 154 | // FIXME: Do not perform this check since older versions of OpenSim do save the control file after other things |
144 | // (I thought they weren't). We will need to bump the version number and perform this check on all | 155 | // (I thought they weren't). We will need to bump the version number and perform this check on all |
@@ -161,6 +172,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
161 | { | 172 | { |
162 | try | 173 | try |
163 | { | 174 | { |
175 | Exception reportedException = null; | ||
176 | |||
164 | string filePath = "ERROR"; | 177 | string filePath = "ERROR"; |
165 | 178 | ||
166 | List<InventoryFolderBase> folderCandidates | 179 | List<InventoryFolderBase> folderCandidates |
@@ -197,14 +210,25 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
197 | } | 210 | } |
198 | 211 | ||
199 | archive.Close(); | 212 | archive.Close(); |
200 | 213 | ||
201 | m_log.DebugFormat( | 214 | m_log.DebugFormat( |
202 | "[INVENTORY ARCHIVER]: Successfully loaded {0} assets with {1} failures", | 215 | "[INVENTORY ARCHIVER]: Successfully loaded {0} assets with {1} failures", |
203 | m_successfulAssetRestores, m_failedAssetRestores); | 216 | m_successfulAssetRestores, m_failedAssetRestores); |
204 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Successfully loaded {0} items", m_successfulItemRestores); | 217 | |
218 | //Alicia: When this is called by LibraryModule or Tests, m_module will be null as event is not required | ||
219 | if(m_module != null) | ||
220 | m_module.TriggerInventoryArchiveLoaded(m_id, true, m_userInfo, m_invPath, m_loadStream, reportedException, m_successfulItemRestores); | ||
205 | 221 | ||
206 | return m_loadedNodes; | 222 | return m_loadedNodes; |
207 | } | 223 | } |
224 | catch(Exception Ex) | ||
225 | { | ||
226 | // Trigger saved event with failed result and exception data | ||
227 | if (m_module != null) | ||
228 | m_module.TriggerInventoryArchiveLoaded(m_id, false, m_userInfo, m_invPath, m_loadStream, Ex, 0); | ||
229 | |||
230 | return m_loadedNodes; | ||
231 | } | ||
208 | finally | 232 | finally |
209 | { | 233 | { |
210 | m_loadStream.Close(); | 234 | m_loadStream.Close(); |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs index 0605db5..401a238 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs | |||
@@ -61,6 +61,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
61 | /// </summary> | 61 | /// </summary> |
62 | public string FilterContent { get; set; } | 62 | public string FilterContent { get; set; } |
63 | 63 | ||
64 | /// <summary> | ||
65 | /// Counter for inventory items saved to archive for passing to compltion event | ||
66 | /// </summary> | ||
67 | public int CountItems { get; set; } | ||
68 | |||
69 | /// <summary> | ||
70 | /// Counter for inventory items skipped due to permission filter option for passing to compltion event | ||
71 | /// </summary> | ||
72 | public int CountFiltered { get; set; } | ||
73 | |||
64 | /// <value> | 74 | /// <value> |
65 | /// Used to select all inventory nodes in a folder but not the folder itself | 75 | /// Used to select all inventory nodes in a folder but not the folder itself |
66 | /// </value> | 76 | /// </value> |
@@ -158,7 +168,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
158 | } | 168 | } |
159 | 169 | ||
160 | m_module.TriggerInventoryArchiveSaved( | 170 | m_module.TriggerInventoryArchiveSaved( |
161 | m_id, succeeded, m_userInfo, m_invPath, m_saveStream, reportedException); | 171 | m_id, succeeded, m_userInfo, m_invPath, m_saveStream, reportedException, CountItems, CountFiltered); |
162 | } | 172 | } |
163 | 173 | ||
164 | protected void SaveInvItem(InventoryItemBase inventoryItem, string path, Dictionary<string, object> options, IUserAccountService userAccountService) | 174 | protected void SaveInvItem(InventoryItemBase inventoryItem, string path, Dictionary<string, object> options, IUserAccountService userAccountService) |
@@ -174,6 +184,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
174 | "[INVENTORY ARCHIVER]: Skipping inventory item {0} {1} at {2}", | 184 | "[INVENTORY ARCHIVER]: Skipping inventory item {0} {1} at {2}", |
175 | inventoryItem.Name, inventoryItem.ID, path); | 185 | inventoryItem.Name, inventoryItem.ID, path); |
176 | } | 186 | } |
187 | |||
188 | CountFiltered++; | ||
189 | |||
177 | return; | 190 | return; |
178 | } | 191 | } |
179 | } | 192 | } |
@@ -184,6 +197,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
184 | m_log.InfoFormat( | 197 | m_log.InfoFormat( |
185 | "[INVENTORY ARCHIVER]: Insufficient permissions, skipping inventory item {0} {1} at {2}", | 198 | "[INVENTORY ARCHIVER]: Insufficient permissions, skipping inventory item {0} {1} at {2}", |
186 | inventoryItem.Name, inventoryItem.ID, path); | 199 | inventoryItem.Name, inventoryItem.ID, path); |
200 | |||
201 | // Count Items Excluded | ||
202 | CountFiltered++; | ||
203 | |||
187 | return; | 204 | return; |
188 | } | 205 | } |
189 | 206 | ||
@@ -202,6 +219,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
202 | 219 | ||
203 | AssetType itemAssetType = (AssetType)inventoryItem.AssetType; | 220 | AssetType itemAssetType = (AssetType)inventoryItem.AssetType; |
204 | 221 | ||
222 | // Count inventory items (different to asset count) | ||
223 | CountItems++; | ||
224 | |||
205 | // Don't chase down link asset items as they actually point to their target item IDs rather than an asset | 225 | // Don't chase down link asset items as they actually point to their target item IDs rather than an asset |
206 | if (SaveAssets && itemAssetType != AssetType.Link && itemAssetType != AssetType.LinkFolder) | 226 | if (SaveAssets && itemAssetType != AssetType.Link && itemAssetType != AssetType.LinkFolder) |
207 | m_assetGatherer.GatherAssetUuids(inventoryItem.AssetID, (sbyte)inventoryItem.AssetType, m_assetUuids); | 227 | m_assetGatherer.GatherAssetUuids(inventoryItem.AssetID, (sbyte)inventoryItem.AssetType, m_assetUuids); |
@@ -363,7 +383,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
363 | // We couldn't find the path indicated | 383 | // We couldn't find the path indicated |
364 | string errorMessage = string.Format("Aborted save. Could not find inventory path {0}", m_invPath); | 384 | string errorMessage = string.Format("Aborted save. Could not find inventory path {0}", m_invPath); |
365 | Exception e = new InventoryArchiverException(errorMessage); | 385 | Exception e = new InventoryArchiverException(errorMessage); |
366 | m_module.TriggerInventoryArchiveSaved(m_id, false, m_userInfo, m_invPath, m_saveStream, e); | 386 | m_module.TriggerInventoryArchiveSaved(m_id, false, m_userInfo, m_invPath, m_saveStream, e, 0, 0); |
367 | throw e; | 387 | throw e; |
368 | } | 388 | } |
369 | 389 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index 0e4d79c..b85bbea 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs | |||
@@ -57,6 +57,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
57 | // public bool DisablePresenceChecks { get; set; } | 57 | // public bool DisablePresenceChecks { get; set; } |
58 | 58 | ||
59 | public event InventoryArchiveSaved OnInventoryArchiveSaved; | 59 | public event InventoryArchiveSaved OnInventoryArchiveSaved; |
60 | public event InventoryArchiveLoaded OnInventoryArchiveLoaded; | ||
60 | 61 | ||
61 | /// <summary> | 62 | /// <summary> |
62 | /// The file to load and save inventory if no filename has been specified | 63 | /// The file to load and save inventory if no filename has been specified |
@@ -64,9 +65,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
64 | protected const string DEFAULT_INV_BACKUP_FILENAME = "user-inventory.iar"; | 65 | protected const string DEFAULT_INV_BACKUP_FILENAME = "user-inventory.iar"; |
65 | 66 | ||
66 | /// <value> | 67 | /// <value> |
67 | /// Pending save completions initiated from the console | 68 | /// Pending save and load completions initiated from the console |
68 | /// </value> | 69 | /// </value> |
69 | protected List<UUID> m_pendingConsoleSaves = new List<UUID>(); | 70 | protected List<UUID> m_pendingConsoleTasks = new List<UUID>(); |
70 | 71 | ||
71 | /// <value> | 72 | /// <value> |
72 | /// All scenes that this module knows about | 73 | /// All scenes that this module knows about |
@@ -111,6 +112,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
111 | { | 112 | { |
112 | scene.RegisterModuleInterface<IInventoryArchiverModule>(this); | 113 | scene.RegisterModuleInterface<IInventoryArchiverModule>(this); |
113 | OnInventoryArchiveSaved += SaveInvConsoleCommandCompleted; | 114 | OnInventoryArchiveSaved += SaveInvConsoleCommandCompleted; |
115 | OnInventoryArchiveLoaded += LoadInvConsoleCommandCompleted; | ||
114 | 116 | ||
115 | scene.AddCommand( | 117 | scene.AddCommand( |
116 | "Archiving", this, "load iar", | 118 | "Archiving", this, "load iar", |
@@ -176,11 +178,23 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
176 | /// </summary> | 178 | /// </summary> |
177 | protected internal void TriggerInventoryArchiveSaved( | 179 | protected internal void TriggerInventoryArchiveSaved( |
178 | UUID id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, | 180 | UUID id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, |
179 | Exception reportedException) | 181 | Exception reportedException, int SaveCount, int FilterCount) |
180 | { | 182 | { |
181 | InventoryArchiveSaved handlerInventoryArchiveSaved = OnInventoryArchiveSaved; | 183 | InventoryArchiveSaved handlerInventoryArchiveSaved = OnInventoryArchiveSaved; |
182 | if (handlerInventoryArchiveSaved != null) | 184 | if (handlerInventoryArchiveSaved != null) |
183 | handlerInventoryArchiveSaved(id, succeeded, userInfo, invPath, saveStream, reportedException); | 185 | handlerInventoryArchiveSaved(id, succeeded, userInfo, invPath, saveStream, reportedException, SaveCount , FilterCount); |
186 | } | ||
187 | |||
188 | /// <summary> | ||
189 | /// Trigger the inventory archive loaded event. | ||
190 | /// </summary> | ||
191 | protected internal void TriggerInventoryArchiveLoaded( | ||
192 | UUID id, bool succeeded, UserAccount userInfo, string invPath, Stream loadStream, | ||
193 | Exception reportedException, int LoadCount) | ||
194 | { | ||
195 | InventoryArchiveLoaded handlerInventoryArchiveLoaded = OnInventoryArchiveLoaded; | ||
196 | if (handlerInventoryArchiveLoaded != null) | ||
197 | handlerInventoryArchiveLoaded(id, succeeded, userInfo, invPath, loadStream, reportedException, LoadCount); | ||
184 | } | 198 | } |
185 | 199 | ||
186 | public bool ArchiveInventory( | 200 | public bool ArchiveInventory( |
@@ -272,13 +286,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
272 | return false; | 286 | return false; |
273 | } | 287 | } |
274 | 288 | ||
275 | public bool DearchiveInventory(string firstName, string lastName, string invPath, string pass, Stream loadStream) | 289 | public bool DearchiveInventory(UUID id, string firstName, string lastName, string invPath, string pass, Stream loadStream) |
276 | { | 290 | { |
277 | return DearchiveInventory(firstName, lastName, invPath, pass, loadStream, new Dictionary<string, object>()); | 291 | return DearchiveInventory(id, firstName, lastName, invPath, pass, loadStream, new Dictionary<string, object>()); |
278 | } | 292 | } |
279 | 293 | ||
280 | public bool DearchiveInventory( | 294 | public bool DearchiveInventory( |
281 | string firstName, string lastName, string invPath, string pass, Stream loadStream, | 295 | UUID id, string firstName, string lastName, string invPath, string pass, Stream loadStream, |
282 | Dictionary<string, object> options) | 296 | Dictionary<string, object> options) |
283 | { | 297 | { |
284 | if (m_scenes.Count > 0) | 298 | if (m_scenes.Count > 0) |
@@ -294,7 +308,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
294 | 308 | ||
295 | try | 309 | try |
296 | { | 310 | { |
297 | request = new InventoryArchiveReadRequest(m_aScene.InventoryService, m_aScene.AssetService, m_aScene.UserAccountService, userInfo, invPath, loadStream, merge); | 311 | request = new InventoryArchiveReadRequest(id, m_aScene.InventoryService, this, m_aScene.AssetService, m_aScene.UserAccountService, userInfo, invPath, loadStream, merge); |
298 | } | 312 | } |
299 | catch (EntryPointNotFoundException e) | 313 | catch (EntryPointNotFoundException e) |
300 | { | 314 | { |
@@ -326,7 +340,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
326 | } | 340 | } |
327 | 341 | ||
328 | public bool DearchiveInventory( | 342 | public bool DearchiveInventory( |
329 | string firstName, string lastName, string invPath, string pass, string loadPath, | 343 | UUID id, string firstName, string lastName, string invPath, string pass, string loadPath, |
330 | Dictionary<string, object> options) | 344 | Dictionary<string, object> options) |
331 | { | 345 | { |
332 | if (m_scenes.Count > 0) | 346 | if (m_scenes.Count > 0) |
@@ -342,7 +356,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
342 | 356 | ||
343 | try | 357 | try |
344 | { | 358 | { |
345 | request = new InventoryArchiveReadRequest(m_aScene.InventoryService, m_aScene.AssetService, m_aScene.UserAccountService, userInfo, invPath, loadPath, merge); | 359 | request = new InventoryArchiveReadRequest(id, m_aScene.InventoryService, this, m_aScene.AssetService, m_aScene.UserAccountService, userInfo, invPath, loadPath, merge); |
346 | } | 360 | } |
347 | catch (EntryPointNotFoundException e) | 361 | catch (EntryPointNotFoundException e) |
348 | { | 362 | { |
@@ -378,6 +392,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
378 | { | 392 | { |
379 | try | 393 | try |
380 | { | 394 | { |
395 | UUID id = UUID.Random(); | ||
396 | |||
381 | Dictionary<string, object> options = new Dictionary<string, object>(); | 397 | Dictionary<string, object> options = new Dictionary<string, object>(); |
382 | OptionSet optionSet = new OptionSet().Add("m|merge", delegate (string v) { options["merge"] = v != null; }); | 398 | OptionSet optionSet = new OptionSet().Add("m|merge", delegate (string v) { options["merge"] = v != null; }); |
383 | 399 | ||
@@ -400,10 +416,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
400 | "[INVENTORY ARCHIVER]: Loading archive {0} to inventory path {1} for {2} {3}", | 416 | "[INVENTORY ARCHIVER]: Loading archive {0} to inventory path {1} for {2} {3}", |
401 | loadPath, invPath, firstName, lastName); | 417 | loadPath, invPath, firstName, lastName); |
402 | 418 | ||
403 | if (DearchiveInventory(firstName, lastName, invPath, pass, loadPath, options)) | 419 | lock (m_pendingConsoleTasks) |
404 | m_log.InfoFormat( | 420 | m_pendingConsoleTasks.Add(id); |
405 | "[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}", | 421 | |
406 | loadPath, firstName, lastName); | 422 | DearchiveInventory(id, firstName, lastName, invPath, pass, loadPath, options); |
407 | } | 423 | } |
408 | catch (InventoryArchiverException e) | 424 | catch (InventoryArchiverException e) |
409 | { | 425 | { |
@@ -465,8 +481,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
465 | "[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}", | 481 | "[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}", |
466 | savePath, invPath, firstName, lastName); | 482 | savePath, invPath, firstName, lastName); |
467 | 483 | ||
468 | lock (m_pendingConsoleSaves) | 484 | lock (m_pendingConsoleTasks) |
469 | m_pendingConsoleSaves.Add(id); | 485 | m_pendingConsoleTasks.Add(id); |
470 | 486 | ||
471 | ArchiveInventory(id, firstName, lastName, invPath, pass, savePath, options); | 487 | ArchiveInventory(id, firstName, lastName, invPath, pass, savePath, options); |
472 | } | 488 | } |
@@ -478,19 +494,23 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
478 | 494 | ||
479 | private void SaveInvConsoleCommandCompleted( | 495 | private void SaveInvConsoleCommandCompleted( |
480 | UUID id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, | 496 | UUID id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, |
481 | Exception reportedException) | 497 | Exception reportedException, int SaveCount, int FilterCount) |
482 | { | 498 | { |
483 | lock (m_pendingConsoleSaves) | 499 | lock (m_pendingConsoleTasks) |
484 | { | 500 | { |
485 | if (m_pendingConsoleSaves.Contains(id)) | 501 | if (m_pendingConsoleTasks.Contains(id)) |
486 | m_pendingConsoleSaves.Remove(id); | 502 | m_pendingConsoleTasks.Remove(id); |
487 | else | 503 | else |
488 | return; | 504 | return; |
489 | } | 505 | } |
490 | 506 | ||
491 | if (succeeded) | 507 | if (succeeded) |
492 | { | 508 | { |
493 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Saved archive for {0} {1}", userInfo.FirstName, userInfo.LastName); | 509 | // Report success and include item count and filter count (Skipped items due to --perm or --exclude switches) |
510 | if(FilterCount == 0) | ||
511 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Saved archive with {0} items for {1} {2}", SaveCount, userInfo.FirstName, userInfo.LastName); | ||
512 | else | ||
513 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Saved archive with {0} items for {1} {2}. Skipped {3} items due to exclude and/or perm switches", SaveCount, userInfo.FirstName, userInfo.LastName, FilterCount); | ||
494 | } | 514 | } |
495 | else | 515 | else |
496 | { | 516 | { |
@@ -500,6 +520,30 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
500 | } | 520 | } |
501 | } | 521 | } |
502 | 522 | ||
523 | private void LoadInvConsoleCommandCompleted( | ||
524 | UUID id, bool succeeded, UserAccount userInfo, string invPath, Stream loadStream, | ||
525 | Exception reportedException, int LoadCount) | ||
526 | { | ||
527 | lock (m_pendingConsoleTasks) | ||
528 | { | ||
529 | if (m_pendingConsoleTasks.Contains(id)) | ||
530 | m_pendingConsoleTasks.Remove(id); | ||
531 | else | ||
532 | return; | ||
533 | } | ||
534 | |||
535 | if (succeeded) | ||
536 | { | ||
537 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Loaded {0} items from archive {1} for {2} {3}", LoadCount, invPath, userInfo.FirstName, userInfo.LastName); | ||
538 | } | ||
539 | else | ||
540 | { | ||
541 | m_log.ErrorFormat( | ||
542 | "[INVENTORY ARCHIVER]: Archive load for {0} {1} failed - {2}", | ||
543 | userInfo.FirstName, userInfo.LastName, reportedException.Message); | ||
544 | } | ||
545 | } | ||
546 | |||
503 | /// <summary> | 547 | /// <summary> |
504 | /// Get user information for the given name. | 548 | /// Get user information for the given name. |
505 | /// </summary> | 549 | /// </summary> |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadPathTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadPathTests.cs index dabece3..eb2515e 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadPathTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadPathTests.cs | |||
@@ -69,8 +69,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
69 | 69 | ||
70 | UserAccountHelpers.CreateUserWithInventory(scene, m_uaMT, "meowfood"); | 70 | UserAccountHelpers.CreateUserWithInventory(scene, m_uaMT, "meowfood"); |
71 | UserAccountHelpers.CreateUserWithInventory(scene, m_uaLL1, "hampshire"); | 71 | UserAccountHelpers.CreateUserWithInventory(scene, m_uaLL1, "hampshire"); |
72 | 72 | ||
73 | archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/", "meowfood", m_iarStream); | 73 | archiverModule.DearchiveInventory(UUID.Random(), m_uaMT.FirstName, m_uaMT.LastName, "/", "meowfood", m_iarStream); |
74 | InventoryItemBase foundItem1 | 74 | InventoryItemBase foundItem1 |
75 | = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_uaMT.PrincipalID, m_item1Name); | 75 | = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_uaMT.PrincipalID, m_item1Name); |
76 | 76 | ||
@@ -79,7 +79,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
79 | // Now try loading to a root child folder | 79 | // Now try loading to a root child folder |
80 | UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, m_uaMT.PrincipalID, "xA", false); | 80 | UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, m_uaMT.PrincipalID, "xA", false); |
81 | MemoryStream archiveReadStream = new MemoryStream(m_iarStream.ToArray()); | 81 | MemoryStream archiveReadStream = new MemoryStream(m_iarStream.ToArray()); |
82 | archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "xA", "meowfood", archiveReadStream); | 82 | archiverModule.DearchiveInventory(UUID.Random(), m_uaMT.FirstName, m_uaMT.LastName, "xA", "meowfood", archiveReadStream); |
83 | 83 | ||
84 | InventoryItemBase foundItem2 | 84 | InventoryItemBase foundItem2 |
85 | = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_uaMT.PrincipalID, "xA/" + m_item1Name); | 85 | = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_uaMT.PrincipalID, "xA/" + m_item1Name); |
@@ -88,7 +88,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
88 | // Now try loading to a more deeply nested folder | 88 | // Now try loading to a more deeply nested folder |
89 | UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, m_uaMT.PrincipalID, "xB/xC", false); | 89 | UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, m_uaMT.PrincipalID, "xB/xC", false); |
90 | archiveReadStream = new MemoryStream(archiveReadStream.ToArray()); | 90 | archiveReadStream = new MemoryStream(archiveReadStream.ToArray()); |
91 | archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "xB/xC", "meowfood", archiveReadStream); | 91 | archiverModule.DearchiveInventory(UUID.Random(), m_uaMT.FirstName, m_uaMT.LastName, "xB/xC", "meowfood", archiveReadStream); |
92 | 92 | ||
93 | InventoryItemBase foundItem3 | 93 | InventoryItemBase foundItem3 |
94 | = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_uaMT.PrincipalID, "xB/xC/" + m_item1Name); | 94 | = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_uaMT.PrincipalID, "xB/xC/" + m_item1Name); |
@@ -110,7 +110,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
110 | SceneHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); | 110 | SceneHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); |
111 | 111 | ||
112 | UserAccountHelpers.CreateUserWithInventory(scene, m_uaMT, "password"); | 112 | UserAccountHelpers.CreateUserWithInventory(scene, m_uaMT, "password"); |
113 | archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/Objects", "password", m_iarStream); | 113 | archiverModule.DearchiveInventory(UUID.Random(), m_uaMT.FirstName, m_uaMT.LastName, "/Objects", "password", m_iarStream); |
114 | 114 | ||
115 | InventoryItemBase foundItem1 | 115 | InventoryItemBase foundItem1 |
116 | = InventoryArchiveUtils.FindItemByPath( | 116 | = InventoryArchiveUtils.FindItemByPath( |
@@ -185,8 +185,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
185 | 185 | ||
186 | // LOAD ITEM | 186 | // LOAD ITEM |
187 | MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); | 187 | MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); |
188 | 188 | ||
189 | archiverModule.DearchiveInventory(userFirstName, userLastName, "Scripts", userPassword, archiveReadStream); | 189 | archiverModule.DearchiveInventory(UUID.Random(), userFirstName, userLastName, "Scripts", userPassword, archiveReadStream); |
190 | 190 | ||
191 | InventoryItemBase foundItem1 | 191 | InventoryItemBase foundItem1 |
192 | = InventoryArchiveUtils.FindItemByPath( | 192 | = InventoryArchiveUtils.FindItemByPath( |
@@ -229,7 +229,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
229 | 229 | ||
230 | { | 230 | { |
231 | // Test replication of path1 | 231 | // Test replication of path1 |
232 | new InventoryArchiveReadRequest(scene.InventoryService, scene.AssetService, scene.UserAccountService, ua1, null, (Stream)null, false) | 232 | new InventoryArchiveReadRequest(UUID.Random(), scene.InventoryService, null, scene.AssetService, scene.UserAccountService, ua1, null, (Stream)null, false) |
233 | .ReplicateArchivePathToUserInventory( | 233 | .ReplicateArchivePathToUserInventory( |
234 | iarPath1, scene.InventoryService.GetRootFolder(ua1.PrincipalID), | 234 | iarPath1, scene.InventoryService.GetRootFolder(ua1.PrincipalID), |
235 | foldersCreated, nodesLoaded); | 235 | foldersCreated, nodesLoaded); |
@@ -246,7 +246,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
246 | 246 | ||
247 | { | 247 | { |
248 | // Test replication of path2 | 248 | // Test replication of path2 |
249 | new InventoryArchiveReadRequest(scene.InventoryService, scene.AssetService, scene.UserAccountService, ua1, null, (Stream)null, false) | 249 | new InventoryArchiveReadRequest(UUID.Random(), scene.InventoryService, null, scene.AssetService, scene.UserAccountService, ua1, null, (Stream)null, false) |
250 | .ReplicateArchivePathToUserInventory( | 250 | .ReplicateArchivePathToUserInventory( |
251 | iarPath2, scene.InventoryService.GetRootFolder(ua1.PrincipalID), | 251 | iarPath2, scene.InventoryService.GetRootFolder(ua1.PrincipalID), |
252 | foldersCreated, nodesLoaded); | 252 | foldersCreated, nodesLoaded); |
@@ -292,7 +292,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
292 | 292 | ||
293 | string itemArchivePath = string.Join("", new string[] { folder1ArchiveName, folder2ArchiveName }); | 293 | string itemArchivePath = string.Join("", new string[] { folder1ArchiveName, folder2ArchiveName }); |
294 | 294 | ||
295 | new InventoryArchiveReadRequest(scene.InventoryService, scene.AssetService, scene.UserAccountService, ua1, null, (Stream)null, false) | 295 | new InventoryArchiveReadRequest(UUID.Random(), scene.InventoryService, null, scene.AssetService, scene.UserAccountService, ua1, null, (Stream)null, false) |
296 | .ReplicateArchivePathToUserInventory( | 296 | .ReplicateArchivePathToUserInventory( |
297 | itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID), | 297 | itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID), |
298 | new Dictionary<string, InventoryFolderBase>(), new HashSet<InventoryNodeBase>()); | 298 | new Dictionary<string, InventoryFolderBase>(), new HashSet<InventoryNodeBase>()); |
@@ -343,7 +343,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
343 | 343 | ||
344 | string itemArchivePath = string.Join("", new string[] { folder1ArchiveName, folder2ArchiveName }); | 344 | string itemArchivePath = string.Join("", new string[] { folder1ArchiveName, folder2ArchiveName }); |
345 | 345 | ||
346 | new InventoryArchiveReadRequest(scene.InventoryService, scene.AssetService, scene.UserAccountService, ua1, folder1ExistingName, (Stream)null, true) | 346 | new InventoryArchiveReadRequest(UUID.Random(), scene.InventoryService, null, scene.AssetService, scene.UserAccountService, ua1, folder1ExistingName, (Stream)null, true) |
347 | .ReplicateArchivePathToUserInventory( | 347 | .ReplicateArchivePathToUserInventory( |
348 | itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID), | 348 | itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID), |
349 | new Dictionary<string, InventoryFolderBase>(), new HashSet<InventoryNodeBase>()); | 349 | new Dictionary<string, InventoryFolderBase>(), new HashSet<InventoryNodeBase>()); |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadTests.cs index 1b521fc..3f16a16 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadTests.cs | |||
@@ -72,7 +72,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
72 | // TestHelpers.EnableLogging(); | 72 | // TestHelpers.EnableLogging(); |
73 | 73 | ||
74 | UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL1, "password"); | 74 | UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL1, "password"); |
75 | m_archiverModule.DearchiveInventory(m_uaLL1.FirstName, m_uaLL1.LastName, "/", "password", m_iarStream); | 75 | m_archiverModule.DearchiveInventory(UUID.Random(), m_uaLL1.FirstName, m_uaLL1.LastName, "/", "password", m_iarStream); |
76 | 76 | ||
77 | InventoryItemBase coaItem | 77 | InventoryItemBase coaItem |
78 | = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaLL1.PrincipalID, m_coaItemName); | 78 | = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaLL1.PrincipalID, m_coaItemName); |
@@ -106,8 +106,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
106 | // log4net.Config.XmlConfigurator.Configure(); | 106 | // log4net.Config.XmlConfigurator.Configure(); |
107 | 107 | ||
108 | UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL1, "meowfood"); | 108 | UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL1, "meowfood"); |
109 | 109 | ||
110 | m_archiverModule.DearchiveInventory(m_uaLL1.FirstName, m_uaLL1.LastName, "/", "meowfood", m_iarStream); | 110 | m_archiverModule.DearchiveInventory(UUID.Random(), m_uaLL1.FirstName, m_uaLL1.LastName, "/", "meowfood", m_iarStream); |
111 | InventoryItemBase foundItem1 | 111 | InventoryItemBase foundItem1 |
112 | = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaLL1.PrincipalID, m_item1Name); | 112 | = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaLL1.PrincipalID, m_item1Name); |
113 | 113 | ||
@@ -171,7 +171,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
171 | // log4net.Config.XmlConfigurator.Configure(); | 171 | // log4net.Config.XmlConfigurator.Configure(); |
172 | 172 | ||
173 | UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaMT, "password"); | 173 | UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaMT, "password"); |
174 | m_archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/", "password", m_iarStream); | 174 | m_archiverModule.DearchiveInventory(UUID.Random(), m_uaMT.FirstName, m_uaMT.LastName, "/", "password", m_iarStream); |
175 | 175 | ||
176 | InventoryItemBase foundItem1 | 176 | InventoryItemBase foundItem1 |
177 | = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaMT.PrincipalID, m_item1Name); | 177 | = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaMT.PrincipalID, m_item1Name); |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveSaveTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveSaveTests.cs index 254aa11..4791a79 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveSaveTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveSaveTests.cs | |||
@@ -85,8 +85,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
85 | byte[] data = tar.ReadEntry(out filePath, out tarEntryType); | 85 | byte[] data = tar.ReadEntry(out filePath, out tarEntryType); |
86 | Assert.That(filePath, Is.EqualTo(ArchiveConstants.CONTROL_FILE_PATH)); | 86 | Assert.That(filePath, Is.EqualTo(ArchiveConstants.CONTROL_FILE_PATH)); |
87 | 87 | ||
88 | InventoryArchiveReadRequest iarr | 88 | InventoryArchiveReadRequest iarr |
89 | = new InventoryArchiveReadRequest(null, null, null, null, null, (Stream)null, false); | 89 | = new InventoryArchiveReadRequest(UUID.Random(), null, null, null, null, null, null, (Stream)null, false); |
90 | iarr.LoadControlFile(filePath, data); | 90 | iarr.LoadControlFile(filePath, data); |
91 | 91 | ||
92 | Assert.That(iarr.ControlFileLoaded, Is.True); | 92 | Assert.That(iarr.ControlFileLoaded, Is.True); |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs index cc746d5..e2d95da 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs | |||
@@ -170,7 +170,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
170 | 170 | ||
171 | protected void SaveCompleted( | 171 | protected void SaveCompleted( |
172 | UUID id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, | 172 | UUID id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, |
173 | Exception reportedException) | 173 | Exception reportedException, int SaveCount, int FilterCount) |
174 | { | 174 | { |
175 | mre.Set(); | 175 | mre.Set(); |
176 | } | 176 | } |
diff --git a/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs b/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs index d10c9b4..4d4720d 100644 --- a/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs +++ b/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs | |||
@@ -176,7 +176,7 @@ namespace OpenSim.Region.CoreModules.Framework.Library | |||
176 | m_log.InfoFormat("[LIBRARY MODULE]: Loading library archive {0} ({1})...", iarFileName, simpleName); | 176 | m_log.InfoFormat("[LIBRARY MODULE]: Loading library archive {0} ({1})...", iarFileName, simpleName); |
177 | simpleName = GetInventoryPathFromName(simpleName); | 177 | simpleName = GetInventoryPathFromName(simpleName); |
178 | 178 | ||
179 | InventoryArchiveReadRequest archread = new InventoryArchiveReadRequest(m_MockScene.InventoryService, m_MockScene.AssetService, m_MockScene.UserAccountService, uinfo, simpleName, iarFileName, false); | 179 | InventoryArchiveReadRequest archread = new InventoryArchiveReadRequest(UUID.Random(), m_MockScene.InventoryService, null, m_MockScene.AssetService, m_MockScene.UserAccountService, uinfo, simpleName, iarFileName, false); |
180 | try | 180 | try |
181 | { | 181 | { |
182 | HashSet<InventoryNodeBase> nodes = archread.Execute(); | 182 | HashSet<InventoryNodeBase> nodes = archread.Execute(); |
@@ -185,7 +185,7 @@ namespace OpenSim.Region.CoreModules.Framework.Library | |||
185 | // didn't find the subfolder with the given name; place it on the top | 185 | // didn't find the subfolder with the given name; place it on the top |
186 | m_log.InfoFormat("[LIBRARY MODULE]: Didn't find {0} in library. Placing archive on the top level", simpleName); | 186 | m_log.InfoFormat("[LIBRARY MODULE]: Didn't find {0} in library. Placing archive on the top level", simpleName); |
187 | archread.Close(); | 187 | archread.Close(); |
188 | archread = new InventoryArchiveReadRequest(m_MockScene.InventoryService, m_MockScene.AssetService, m_MockScene.UserAccountService, uinfo, "/", iarFileName, false); | 188 | archread = new InventoryArchiveReadRequest(UUID.Random(), m_MockScene.InventoryService, null, m_MockScene.AssetService, m_MockScene.UserAccountService, uinfo, "/", iarFileName, false); |
189 | archread.Execute(); | 189 | archread.Execute(); |
190 | } | 190 | } |
191 | 191 | ||