diff options
author | Justin Clarke Casey | 2009-02-12 17:41:09 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2009-02-12 17:41:09 +0000 |
commit | f74326c1b05237e5a9eb3fce897ed1bec3085961 (patch) | |
tree | 192d667de632d54d8dc68077badd01a227e0a155 /OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs | |
parent | * Remove some pointless CachedUserInfo != null tests since these are already ... (diff) | |
download | opensim-SC_OLD-f74326c1b05237e5a9eb3fce897ed1bec3085961.zip opensim-SC_OLD-f74326c1b05237e5a9eb3fce897ed1bec3085961.tar.gz opensim-SC_OLD-f74326c1b05237e5a9eb3fce897ed1bec3085961.tar.bz2 opensim-SC_OLD-f74326c1b05237e5a9eb3fce897ed1bec3085961.tar.xz |
* move userinfo for inventory archiving up to module class so that it only has to be done once
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs | 47 |
1 files changed, 14 insertions, 33 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs index da4785b..622ba86 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs | |||
@@ -48,8 +48,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
48 | protected CommunicationsManager commsManager; | 48 | protected CommunicationsManager commsManager; |
49 | protected Dictionary<UUID, int> assetUuids = new Dictionary<UUID, int>(); | 49 | protected Dictionary<UUID, int> assetUuids = new Dictionary<UUID, int>(); |
50 | 50 | ||
51 | private string m_firstName; | 51 | private CachedUserInfo m_userInfo; |
52 | private string m_lastName; | ||
53 | private string m_invPath; | 52 | private string m_invPath; |
54 | 53 | ||
55 | /// <value> | 54 | /// <value> |
@@ -61,13 +60,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
61 | /// Constructor | 60 | /// Constructor |
62 | /// </summary> | 61 | /// </summary> |
63 | public InventoryArchiveWriteRequest( | 62 | public InventoryArchiveWriteRequest( |
64 | string firstName, string lastName, string invPath, string savePath, CommunicationsManager commsManager) | 63 | CachedUserInfo userInfo, string invPath, string savePath, CommunicationsManager commsManager) |
65 | : this( | 64 | : this( |
66 | firstName, | 65 | userInfo, |
67 | lastName, | 66 | invPath, |
68 | invPath, | 67 | new GZipStream(new FileStream(savePath, FileMode.Create), CompressionMode.Compress), |
69 | new GZipStream(new FileStream(savePath, FileMode.Create), CompressionMode.Compress), | 68 | commsManager) |
70 | commsManager) | ||
71 | { | 69 | { |
72 | } | 70 | } |
73 | 71 | ||
@@ -75,10 +73,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
75 | /// Constructor | 73 | /// Constructor |
76 | /// </summary> | 74 | /// </summary> |
77 | public InventoryArchiveWriteRequest( | 75 | public InventoryArchiveWriteRequest( |
78 | string firstName, string lastName, string invPath, Stream saveStream, CommunicationsManager commsManager) | 76 | CachedUserInfo userInfo, string invPath, Stream saveStream, CommunicationsManager commsManager) |
79 | { | 77 | { |
80 | m_firstName = firstName; | 78 | m_userInfo = userInfo; |
81 | m_lastName = lastName; | ||
82 | m_invPath = invPath; | 79 | m_invPath = invPath; |
83 | m_saveStream = saveStream; | 80 | m_saveStream = saveStream; |
84 | this.commsManager = commsManager; | 81 | this.commsManager = commsManager; |
@@ -183,26 +180,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
183 | 180 | ||
184 | public void Execute() | 181 | public void Execute() |
185 | { | 182 | { |
186 | UserProfileData userProfile = commsManager.UserService.GetUserProfile(m_firstName, m_lastName); | ||
187 | if (null == userProfile) | ||
188 | { | ||
189 | m_log.ErrorFormat("[INVENTORY ARCHIVER]: Failed to find user {0} {1}", m_firstName, m_lastName); | ||
190 | return; | ||
191 | } | ||
192 | |||
193 | CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(userProfile.ID); | ||
194 | if (null == userInfo) | ||
195 | { | ||
196 | m_log.ErrorFormat( | ||
197 | "[INVENTORY ARCHIVER]: Failed to find user info for {0} {1} {2}", | ||
198 | m_firstName, m_lastName, userProfile.ID); | ||
199 | return; | ||
200 | } | ||
201 | |||
202 | InventoryFolderImpl inventoryFolder = null; | 183 | InventoryFolderImpl inventoryFolder = null; |
203 | InventoryItemBase inventoryItem = null; | 184 | InventoryItemBase inventoryItem = null; |
204 | 185 | ||
205 | if (userInfo.HasReceivedInventory) | 186 | if (m_userInfo.HasReceivedInventory) |
206 | { | 187 | { |
207 | // Eliminate double slashes and any leading / on the path. This might be better done within InventoryFolderImpl | 188 | // Eliminate double slashes and any leading / on the path. This might be better done within InventoryFolderImpl |
208 | // itself (possibly at a small loss in efficiency). | 189 | // itself (possibly at a small loss in efficiency). |
@@ -218,25 +199,25 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
218 | // Therefore if we still start with a / after the split, then we need the root folder | 199 | // Therefore if we still start with a / after the split, then we need the root folder |
219 | if (m_invPath.Length == 0) | 200 | if (m_invPath.Length == 0) |
220 | { | 201 | { |
221 | inventoryFolder = userInfo.RootFolder; | 202 | inventoryFolder = m_userInfo.RootFolder; |
222 | } | 203 | } |
223 | else | 204 | else |
224 | { | 205 | { |
225 | m_invPath = m_invPath.Remove(m_invPath.LastIndexOf(InventoryFolderImpl.PATH_DELIMITER)); | 206 | m_invPath = m_invPath.Remove(m_invPath.LastIndexOf(InventoryFolderImpl.PATH_DELIMITER)); |
226 | inventoryFolder = userInfo.RootFolder.FindFolderByPath(m_invPath); | 207 | inventoryFolder = m_userInfo.RootFolder.FindFolderByPath(m_invPath); |
227 | } | 208 | } |
228 | 209 | ||
229 | // The path may point to an item instead | 210 | // The path may point to an item instead |
230 | if (inventoryFolder == null) | 211 | if (inventoryFolder == null) |
231 | { | 212 | { |
232 | inventoryItem = userInfo.RootFolder.FindItemByPath(m_invPath); | 213 | inventoryItem = m_userInfo.RootFolder.FindItemByPath(m_invPath); |
233 | } | 214 | } |
234 | } | 215 | } |
235 | else | 216 | else |
236 | { | 217 | { |
237 | m_log.ErrorFormat( | 218 | m_log.ErrorFormat( |
238 | "[INVENTORY ARCHIVER]: Have not yet received inventory info for user {0} {1} {2}", | 219 | "[INVENTORY ARCHIVER]: Have not yet received inventory info for user {0} {1}", |
239 | m_firstName, m_lastName, userProfile.ID); | 220 | m_userInfo.UserProfile.Name, m_userInfo.UserProfile.ID); |
240 | return; | 221 | return; |
241 | } | 222 | } |
242 | 223 | ||