diff options
Merge branch 'master' into careminster
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Archiver')
4 files changed, 67 insertions, 13 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index f204faf..114dd13 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | |||
@@ -103,14 +103,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
103 | List<string> serialisedSceneObjects = new List<string>(); | 103 | List<string> serialisedSceneObjects = new List<string>(); |
104 | List<string> serialisedParcels = new List<string>(); | 104 | List<string> serialisedParcels = new List<string>(); |
105 | string filePath = "NONE"; | 105 | string filePath = "NONE"; |
106 | |||
107 | TarArchiveReader archive = new TarArchiveReader(m_loadStream); | ||
108 | byte[] data; | ||
109 | TarArchiveReader.TarEntryType entryType; | ||
106 | 110 | ||
107 | try | 111 | try |
108 | { | 112 | { |
109 | TarArchiveReader archive = new TarArchiveReader(m_loadStream); | ||
110 | |||
111 | byte[] data; | ||
112 | TarArchiveReader.TarEntryType entryType; | ||
113 | |||
114 | while ((data = archive.ReadEntry(out filePath, out entryType)) != null) | 113 | while ((data = archive.ReadEntry(out filePath, out entryType)) != null) |
115 | { | 114 | { |
116 | //m_log.DebugFormat( | 115 | //m_log.DebugFormat( |
@@ -152,8 +151,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
152 | } | 151 | } |
153 | 152 | ||
154 | //m_log.Debug("[ARCHIVER]: Reached end of archive"); | 153 | //m_log.Debug("[ARCHIVER]: Reached end of archive"); |
155 | |||
156 | archive.Close(); | ||
157 | } | 154 | } |
158 | catch (Exception e) | 155 | catch (Exception e) |
159 | { | 156 | { |
@@ -163,6 +160,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
163 | m_scene.EventManager.TriggerOarFileLoaded(m_requestId, m_errorMessage); | 160 | m_scene.EventManager.TriggerOarFileLoaded(m_requestId, m_errorMessage); |
164 | return; | 161 | return; |
165 | } | 162 | } |
163 | finally | ||
164 | { | ||
165 | archive.Close(); | ||
166 | } | ||
166 | 167 | ||
167 | m_log.InfoFormat("[ARCHIVER]: Restored {0} assets", successfulAssetRestores); | 168 | m_log.InfoFormat("[ARCHIVER]: Restored {0} assets", successfulAssetRestores); |
168 | 169 | ||
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs index f039be8..75c4557 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs | |||
@@ -80,6 +80,22 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
80 | protected internal void ReceivedAllAssets( | 80 | protected internal void ReceivedAllAssets( |
81 | ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids) | 81 | ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids) |
82 | { | 82 | { |
83 | try | ||
84 | { | ||
85 | Save(assetsFoundUuids, assetsNotFoundUuids); | ||
86 | } | ||
87 | finally | ||
88 | { | ||
89 | m_archiveWriter.Close(); | ||
90 | } | ||
91 | |||
92 | m_log.InfoFormat("[ARCHIVER]: Finished writing out OAR for {0}", m_scene.RegionInfo.RegionName); | ||
93 | |||
94 | m_scene.EventManager.TriggerOarFileSaved(m_requestId, String.Empty); | ||
95 | } | ||
96 | |||
97 | protected internal void Save(ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids) | ||
98 | { | ||
83 | foreach (UUID uuid in assetsNotFoundUuids) | 99 | foreach (UUID uuid in assetsNotFoundUuids) |
84 | { | 100 | { |
85 | m_log.DebugFormat("[ARCHIVER]: Could not find asset {0}", uuid); | 101 | m_log.DebugFormat("[ARCHIVER]: Could not find asset {0}", uuid); |
@@ -143,12 +159,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
143 | } | 159 | } |
144 | 160 | ||
145 | m_log.InfoFormat("[ARCHIVER]: Added scene objects to archive."); | 161 | m_log.InfoFormat("[ARCHIVER]: Added scene objects to archive."); |
146 | |||
147 | m_archiveWriter.Close(); | ||
148 | |||
149 | m_log.InfoFormat("[ARCHIVER]: Finished writing out OAR for {0}", m_scene.RegionInfo.RegionName); | ||
150 | |||
151 | m_scene.EventManager.TriggerOarFileSaved(m_requestId, String.Empty); | ||
152 | } | 162 | } |
153 | 163 | ||
154 | /// <summary> | 164 | /// <summary> |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs index 9e4fbbe..f08d8ec 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs | |||
@@ -56,6 +56,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
56 | /// <summary> | 56 | /// <summary> |
57 | /// Constructor | 57 | /// Constructor |
58 | /// </summary> | 58 | /// </summary> |
59 | /// <param name="scene"></param> | ||
60 | /// <param name="savePath">The path to which to save data.</param> | ||
61 | /// <param name="requestId">The id associated with this request</param> | ||
62 | /// <exception cref="System.IO.IOException"> | ||
63 | /// If there was a problem opening a stream for the file specified by the savePath | ||
64 | /// </exception> | ||
59 | public ArchiveWriteRequestPreparation(Scene scene, string savePath, Guid requestId) | 65 | public ArchiveWriteRequestPreparation(Scene scene, string savePath, Guid requestId) |
60 | { | 66 | { |
61 | m_scene = scene; | 67 | m_scene = scene; |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs index 8d4f91b..181f4c6 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs | |||
@@ -45,6 +45,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
45 | 45 | ||
46 | private Scene m_scene; | 46 | private Scene m_scene; |
47 | 47 | ||
48 | /// <value> | ||
49 | /// The file used to load and save an opensimulator archive if no filename has been specified | ||
50 | /// </value> | ||
51 | protected const string DEFAULT_OAR_BACKUP_FILENAME = "region.oar"; | ||
52 | |||
48 | public string Name | 53 | public string Name |
49 | { | 54 | { |
50 | get { return "RegionArchiverModule"; } | 55 | get { return "RegionArchiverModule"; } |
@@ -80,6 +85,38 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
80 | { | 85 | { |
81 | } | 86 | } |
82 | 87 | ||
88 | /// <summary> | ||
89 | /// Load a whole region from an opensimulator archive. | ||
90 | /// </summary> | ||
91 | /// <param name="cmdparams"></param> | ||
92 | public void HandleLoadOarConsoleCommand(string module, string[] cmdparams) | ||
93 | { | ||
94 | if (cmdparams.Length > 2) | ||
95 | { | ||
96 | DearchiveRegion(cmdparams[2]); | ||
97 | } | ||
98 | else | ||
99 | { | ||
100 | DearchiveRegion(DEFAULT_OAR_BACKUP_FILENAME); | ||
101 | } | ||
102 | } | ||
103 | |||
104 | /// <summary> | ||
105 | /// Save a region to a file, including all the assets needed to restore it. | ||
106 | /// </summary> | ||
107 | /// <param name="cmdparams"></param> | ||
108 | public void HandleSaveOarConsoleCommand(string module, string[] cmdparams) | ||
109 | { | ||
110 | if (cmdparams.Length > 2) | ||
111 | { | ||
112 | ArchiveRegion(cmdparams[2]); | ||
113 | } | ||
114 | else | ||
115 | { | ||
116 | ArchiveRegion(DEFAULT_OAR_BACKUP_FILENAME); | ||
117 | } | ||
118 | } | ||
119 | |||
83 | public void ArchiveRegion(string savePath) | 120 | public void ArchiveRegion(string savePath) |
84 | { | 121 | { |
85 | ArchiveRegion(savePath, Guid.Empty); | 122 | ArchiveRegion(savePath, Guid.Empty); |