diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | 80 |
1 files changed, 41 insertions, 39 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index c8697fe..31dfe14 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | |||
@@ -93,37 +93,37 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
93 | /// </returns> | 93 | /// </returns> |
94 | public List<InventoryNodeBase> Execute() | 94 | public List<InventoryNodeBase> Execute() |
95 | { | 95 | { |
96 | string filePath = "ERROR"; | ||
97 | int successfulAssetRestores = 0; | ||
98 | int failedAssetRestores = 0; | ||
99 | int successfulItemRestores = 0; | ||
100 | |||
101 | List<InventoryNodeBase> loadedNodes = new List<InventoryNodeBase>(); | ||
102 | |||
103 | List<InventoryFolderBase> folderCandidates | ||
104 | = InventoryArchiveUtils.FindFolderByPath( | ||
105 | m_scene.InventoryService, m_userInfo.PrincipalID, m_invPath); | ||
106 | |||
107 | if (folderCandidates.Count == 0) | ||
108 | { | ||
109 | // Possibly provide an option later on to automatically create this folder if it does not exist | ||
110 | m_log.ErrorFormat("[INVENTORY ARCHIVER]: Inventory path {0} does not exist", m_invPath); | ||
111 | |||
112 | return loadedNodes; | ||
113 | } | ||
114 | |||
115 | InventoryFolderBase rootDestinationFolder = folderCandidates[0]; | ||
116 | archive = new TarArchiveReader(m_loadStream); | ||
117 | |||
118 | // In order to load identically named folders, we need to keep track of the folders that we have already | ||
119 | // resolved | ||
120 | Dictionary <string, InventoryFolderBase> resolvedFolders = new Dictionary<string, InventoryFolderBase>(); | ||
121 | |||
122 | byte[] data; | ||
123 | TarArchiveReader.TarEntryType entryType; | ||
124 | |||
125 | try | 96 | try |
126 | { | 97 | { |
98 | string filePath = "ERROR"; | ||
99 | int successfulAssetRestores = 0; | ||
100 | int failedAssetRestores = 0; | ||
101 | int successfulItemRestores = 0; | ||
102 | |||
103 | List<InventoryNodeBase> loadedNodes = new List<InventoryNodeBase>(); | ||
104 | |||
105 | List<InventoryFolderBase> folderCandidates | ||
106 | = InventoryArchiveUtils.FindFolderByPath( | ||
107 | m_scene.InventoryService, m_userInfo.PrincipalID, m_invPath); | ||
108 | |||
109 | if (folderCandidates.Count == 0) | ||
110 | { | ||
111 | // Possibly provide an option later on to automatically create this folder if it does not exist | ||
112 | m_log.ErrorFormat("[INVENTORY ARCHIVER]: Inventory path {0} does not exist", m_invPath); | ||
113 | |||
114 | return loadedNodes; | ||
115 | } | ||
116 | |||
117 | InventoryFolderBase rootDestinationFolder = folderCandidates[0]; | ||
118 | archive = new TarArchiveReader(m_loadStream); | ||
119 | |||
120 | // In order to load identically named folders, we need to keep track of the folders that we have already | ||
121 | // resolved | ||
122 | Dictionary <string, InventoryFolderBase> resolvedFolders = new Dictionary<string, InventoryFolderBase>(); | ||
123 | |||
124 | byte[] data; | ||
125 | TarArchiveReader.TarEntryType entryType; | ||
126 | |||
127 | while ((data = archive.ReadEntry(out filePath, out entryType)) != null) | 127 | while ((data = archive.ReadEntry(out filePath, out entryType)) != null) |
128 | { | 128 | { |
129 | if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) | 129 | if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) |
@@ -166,18 +166,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
166 | } | 166 | } |
167 | } | 167 | } |
168 | } | 168 | } |
169 | |||
170 | archive.Close(); | ||
171 | |||
172 | m_log.DebugFormat( | ||
173 | "[INVENTORY ARCHIVER]: Successfully loaded {0} assets with {1} failures", | ||
174 | successfulAssetRestores, failedAssetRestores); | ||
175 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Successfully loaded {0} items", successfulItemRestores); | ||
176 | |||
177 | return loadedNodes; | ||
169 | } | 178 | } |
170 | finally | 179 | finally |
171 | { | 180 | { |
172 | archive.Close(); | 181 | m_loadStream.Close(); |
173 | } | 182 | } |
174 | |||
175 | m_log.DebugFormat( | ||
176 | "[INVENTORY ARCHIVER]: Successfully loaded {0} assets with {1} failures", | ||
177 | successfulAssetRestores, failedAssetRestores); | ||
178 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Successfully loaded {0} items", successfulItemRestores); | ||
179 | |||
180 | return loadedNodes; | ||
181 | } | 183 | } |
182 | 184 | ||
183 | public void Close() | 185 | public void Close() |
@@ -247,7 +249,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
247 | ref string archivePath, | 249 | ref string archivePath, |
248 | Dictionary <string, InventoryFolderBase> resolvedFolders) | 250 | Dictionary <string, InventoryFolderBase> resolvedFolders) |
249 | { | 251 | { |
250 | string originalArchivePath = archivePath; | 252 | // string originalArchivePath = archivePath; |
251 | 253 | ||
252 | InventoryFolderBase destFolder = null; | 254 | InventoryFolderBase destFolder = null; |
253 | 255 | ||