diff options
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs')
-rw-r--r-- | OpenSim/Region/Environment/Modules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/OpenSim/Region/Environment/Modules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/Environment/Modules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 91763a7..79e00cd 100644 --- a/OpenSim/Region/Environment/Modules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/Environment/Modules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | |||
@@ -45,14 +45,15 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver | |||
45 | { | 45 | { |
46 | public class InventoryArchiveReadRequest | 46 | public class InventoryArchiveReadRequest |
47 | { | 47 | { |
48 | private static ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
49 | |||
48 | protected Scene scene; | 50 | protected Scene scene; |
49 | protected TarArchiveReader archive; | 51 | protected TarArchiveReader archive; |
50 | private static System.Text.ASCIIEncoding m_asciiEncoding = new System.Text.ASCIIEncoding(); | 52 | private static System.Text.ASCIIEncoding m_asciiEncoding = new System.Text.ASCIIEncoding(); |
51 | ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 53 | |
52 | CachedUserInfo userInfo; | 54 | CachedUserInfo userInfo; |
53 | UserProfileData userProfile; | 55 | UserProfileData userProfile; |
54 | CommunicationsManager commsManager; | 56 | CommunicationsManager commsManager; |
55 | string loadPath; | ||
56 | 57 | ||
57 | public InventoryArchiveReadRequest(Scene currentScene, CommunicationsManager commsManager) | 58 | public InventoryArchiveReadRequest(Scene currentScene, CommunicationsManager commsManager) |
58 | { | 59 | { |
@@ -142,22 +143,17 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver | |||
142 | return item; | 143 | return item; |
143 | } | 144 | } |
144 | 145 | ||
145 | public void execute(string[] cmdparams) | 146 | public void execute(string firstName, string lastName, string invPath, string loadPath) |
146 | { | 147 | { |
147 | string filePath = "ERROR"; | 148 | string filePath = "ERROR"; |
148 | int successfulAssetRestores = 0; | 149 | int successfulAssetRestores = 0; |
149 | int failedAssetRestores = 0; | 150 | int failedAssetRestores = 0; |
150 | 151 | int successfulItemRestores = 0; | |
151 | string firstName = cmdparams[0]; | ||
152 | string lastName = cmdparams[1]; | ||
153 | //string invPath = cmdparams[2]; | ||
154 | loadPath = (cmdparams.Length > 3 ? cmdparams[3] : "inventory.tar.gz"); | ||
155 | 152 | ||
156 | archive | 153 | archive |
157 | = new TarArchiveReader(new GZipStream( | 154 | = new TarArchiveReader(new GZipStream( |
158 | new FileStream(loadPath, FileMode.Open), CompressionMode.Decompress)); | 155 | new FileStream(loadPath, FileMode.Open), CompressionMode.Decompress)); |
159 | 156 | ||
160 | |||
161 | userProfile = commsManager.UserService.GetUserProfile(firstName, lastName); | 157 | userProfile = commsManager.UserService.GetUserProfile(firstName, lastName); |
162 | userInfo = commsManager.UserProfileCacheService.GetUserDetails(userProfile.ID); | 158 | userInfo = commsManager.UserProfileCacheService.GetUserDetails(userProfile.ID); |
163 | 159 | ||
@@ -175,13 +171,18 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver | |||
175 | { | 171 | { |
176 | //Load the item | 172 | //Load the item |
177 | InventoryItemBase item = loadInvItem(filePath, m_asciiEncoding.GetString(data)); | 173 | InventoryItemBase item = loadInvItem(filePath, m_asciiEncoding.GetString(data)); |
178 | if (item != null) userInfo.AddItem(item); | 174 | if (item != null) |
175 | { | ||
176 | userInfo.AddItem(item); | ||
177 | successfulItemRestores++; | ||
178 | } | ||
179 | } | 179 | } |
180 | } | 180 | } |
181 | 181 | ||
182 | archive.Close(); | 182 | archive.Close(); |
183 | 183 | ||
184 | m_log.InfoFormat("[ARCHIVER]: Restored {0} assets", successfulAssetRestores); | 184 | m_log.DebugFormat("[ARCHIVER]: Restored {0} assets", successfulAssetRestores); |
185 | m_log.InfoFormat("[ARCHIVER]: Restored {0} items", successfulItemRestores); | ||
185 | } | 186 | } |
186 | 187 | ||
187 | /// <summary> | 188 | /// <summary> |