aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authorJustin Clarke Casey2009-02-18 19:26:10 +0000
committerJustin Clarke Casey2009-02-18 19:26:10 +0000
commit5e4cad07eb2cac6671ca86ac19d01f6a882c827d (patch)
tree929e38f3042661b44031c83a4591760d87daeb49 /OpenSim/Region/CoreModules
parentFix estate ban list persistence in MySQL and reenable tests (diff)
downloadopensim-SC_OLD-5e4cad07eb2cac6671ca86ac19d01f6a882c827d.zip
opensim-SC_OLD-5e4cad07eb2cac6671ca86ac19d01f6a882c827d.tar.gz
opensim-SC_OLD-5e4cad07eb2cac6671ca86ac19d01f6a882c827d.tar.bz2
opensim-SC_OLD-5e4cad07eb2cac6671ca86ac19d01f6a882c827d.tar.xz
* Make save iar behave properly if the nominated inventory path does not exist
* load iar probably still fails for this
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs14
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs24
2 files changed, 28 insertions, 10 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
index be700e9..1152a1e 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
@@ -95,6 +95,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
95 } 95 }
96 catch (IOException e) 96 catch (IOException e)
97 { 97 {
98 m_saveStream.Close();
98 reportedException = e; 99 reportedException = e;
99 succeeded = false; 100 succeeded = false;
100 } 101 }
@@ -104,9 +105,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
104 105
105 protected void saveInvItem(InventoryItemBase inventoryItem, string path) 106 protected void saveInvItem(InventoryItemBase inventoryItem, string path)
106 { 107 {
107 string filename 108 string filename = string.Format("{0}{1}_{2}.xml", path, inventoryItem.Name, inventoryItem.ID);
108 = string.Format("{0}{1}_{2}.xml",
109 path, inventoryItem.Name, inventoryItem.ID);
110 StringWriter sw = new StringWriter(); 109 StringWriter sw = new StringWriter();
111 XmlTextWriter writer = new XmlTextWriter(sw); 110 XmlTextWriter writer = new XmlTextWriter(sw);
112 writer.Formatting = Formatting.Indented; 111 writer.Formatting = Formatting.Indented;
@@ -182,6 +181,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
182 List<InventoryItemBase> items = inventoryFolder.RequestListOfItems(); 181 List<InventoryItemBase> items = inventoryFolder.RequestListOfItems();
183 string newPath = path + inventoryFolder.Name + InventoryFolderImpl.PATH_DELIMITER; 182 string newPath = path + inventoryFolder.Name + InventoryFolderImpl.PATH_DELIMITER;
184 archive.AddDir(newPath); 183 archive.AddDir(newPath);
184
185 foreach (InventoryFolderImpl folder in inventories) 185 foreach (InventoryFolderImpl folder in inventories)
186 { 186 {
187 saveInvDir(folder, newPath); 187 saveInvDir(folder, newPath);
@@ -192,6 +192,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
192 } 192 }
193 } 193 }
194 194
195 /// <summary>
196 /// Execute the inventory write request
197 /// </summary>
195 public void Execute() 198 public void Execute()
196 { 199 {
197 InventoryFolderImpl inventoryFolder = null; 200 InventoryFolderImpl inventoryFolder = null;
@@ -251,7 +254,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
251 { 254 {
252 if (null == inventoryItem) 255 if (null == inventoryItem)
253 { 256 {
254 m_log.ErrorFormat("[INVENTORY ARCHIVER]: Could not find inventory entry at path {0}", m_invPath); 257 m_saveStream.Close();
258 m_module.TriggerInventoryArchiveSaved(
259 false, m_userInfo, m_invPath, m_saveStream,
260 new Exception(string.Format("Could not find inventory entry at path {0}", m_invPath)));
255 return; 261 return;
256 } 262 }
257 else 263 else
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
index 1997562..f8a5d9f 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
@@ -73,7 +73,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
73 if (m_scenes.Count == 0) 73 if (m_scenes.Count == 0)
74 { 74 {
75 scene.RegisterModuleInterface<IInventoryArchiverModule>(this); 75 scene.RegisterModuleInterface<IInventoryArchiverModule>(this);
76 CommsManager = scene.CommsManager; 76 CommsManager = scene.CommsManager;
77 OnInventoryArchiveSaved += SaveInvConsoleCommandCompleted;
77 78
78 scene.AddCommand( 79 scene.AddCommand(
79 this, "load iar", 80 this, "load iar",
@@ -207,11 +208,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
207 "[INVENTORY ARCHIVER]: Saving archive {0} from inventory path {1} for {2} {3}", 208 "[INVENTORY ARCHIVER]: Saving archive {0} from inventory path {1} for {2} {3}",
208 savePath, invPath, firstName, lastName); 209 savePath, invPath, firstName, lastName);
209 210
210 ArchiveInventory(firstName, lastName, invPath, savePath); 211 ArchiveInventory(firstName, lastName, invPath, savePath);
211 212 }
212 m_log.InfoFormat( 213
213 "[INVENTORY ARCHIVER]: Saved archive {0} for {1} {2}", 214 private void SaveInvConsoleCommandCompleted(
214 savePath, firstName, lastName); 215 bool succeeded, CachedUserInfo userInfo, string invPath, Stream saveStream, Exception reportedException)
216 {
217 if (succeeded)
218 {
219 m_log.InfoFormat("[INVENTORY ARCHIVER]: Saved archive for {0}", userInfo.UserProfile.Name);
220 }
221 else
222 {
223 m_log.ErrorFormat(
224 "[INVENTORY ARCHIVER]: Archive save for {0} failed - {1}",
225 userInfo.UserProfile.Name, reportedException.Message);
226 }
215 } 227 }
216 228
217 /// <summary> 229 /// <summary>