diff options
Diffstat (limited to 'OpenSim/Region/Modules')
-rw-r--r-- | OpenSim/Region/Modules/SvnSerialiser/SvnBackupModule.cs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/OpenSim/Region/Modules/SvnSerialiser/SvnBackupModule.cs b/OpenSim/Region/Modules/SvnSerialiser/SvnBackupModule.cs index d932c55..8cfc07d 100644 --- a/OpenSim/Region/Modules/SvnSerialiser/SvnBackupModule.cs +++ b/OpenSim/Region/Modules/SvnSerialiser/SvnBackupModule.cs | |||
@@ -18,10 +18,11 @@ namespace OpenSim.Region.Modules.SvnSerialiser | |||
18 | public class SvnBackupModule : IRegionModule | 18 | public class SvnBackupModule : IRegionModule |
19 | { | 19 | { |
20 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 20 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
21 | private readonly List<Scene> m_scenes = new List<Scene>(); | ||
22 | private readonly Timer m_timer = new Timer(); | ||
21 | 23 | ||
22 | private bool m_enabled = false; | 24 | private bool m_enabled = false; |
23 | private bool m_installBackupOnLoad = false; | 25 | private bool m_installBackupOnLoad = false; |
24 | private List<Scene> m_scenes = new List<Scene>(); | ||
25 | private IRegionSerialiser m_serialiser; | 26 | private IRegionSerialiser m_serialiser; |
26 | private bool m_svnAutoSave = false; | 27 | private bool m_svnAutoSave = false; |
27 | private SvnClient m_svnClient; | 28 | private SvnClient m_svnClient; |
@@ -31,7 +32,6 @@ namespace OpenSim.Region.Modules.SvnSerialiser | |||
31 | private TimeSpan m_svnperiod = new TimeSpan(0, 0, 15, 0, 0); | 32 | private TimeSpan m_svnperiod = new TimeSpan(0, 0, 15, 0, 0); |
32 | private string m_svnurl = "svn://insert.your.svn/here/"; | 33 | private string m_svnurl = "svn://insert.your.svn/here/"; |
33 | private string m_svnuser = "username"; | 34 | private string m_svnuser = "username"; |
34 | private Timer m_timer = new Timer(); | ||
35 | 35 | ||
36 | #region SvnModule Core | 36 | #region SvnModule Core |
37 | 37 | ||
@@ -69,11 +69,11 @@ namespace OpenSim.Region.Modules.SvnSerialiser | |||
69 | { | 69 | { |
70 | m_log.Info("[SVNBACKUP]: Saving a region to SVN with name " + scene.RegionInfo.RegionName); | 70 | m_log.Info("[SVNBACKUP]: Saving a region to SVN with name " + scene.RegionInfo.RegionName); |
71 | 71 | ||
72 | List<string> filenames = m_serialiser.SerialiseRegion(scene, m_svndir + Slash.DirectorySeparatorChar + scene.RegionInfo.RegionID.ToString() + "\\"); | 72 | List<string> filenames = m_serialiser.SerialiseRegion(scene, m_svndir + Slash.DirectorySeparatorChar + scene.RegionInfo.RegionID + "\\"); |
73 | 73 | ||
74 | try | 74 | try |
75 | { | 75 | { |
76 | m_svnClient.Add3(m_svndir + Slash.DirectorySeparatorChar + scene.RegionInfo.RegionID.ToString(), true, false, false); | 76 | m_svnClient.Add3(m_svndir + Slash.DirectorySeparatorChar + scene.RegionInfo.RegionID, true, false, false); |
77 | } | 77 | } |
78 | catch (SvnException) | 78 | catch (SvnException) |
79 | { | 79 | { |
@@ -81,17 +81,17 @@ namespace OpenSim.Region.Modules.SvnSerialiser | |||
81 | 81 | ||
82 | List<string> svnfilenames = new List<string>(); | 82 | List<string> svnfilenames = new List<string>(); |
83 | foreach (string filename in filenames) | 83 | foreach (string filename in filenames) |
84 | svnfilenames.Add(m_svndir + Slash.DirectorySeparatorChar + scene.RegionInfo.RegionID.ToString() + Slash.DirectorySeparatorChar + filename); | 84 | svnfilenames.Add(m_svndir + Slash.DirectorySeparatorChar + scene.RegionInfo.RegionID + Slash.DirectorySeparatorChar + filename); |
85 | svnfilenames.Add(m_svndir + Slash.DirectorySeparatorChar + scene.RegionInfo.RegionID.ToString()); | 85 | svnfilenames.Add(m_svndir + Slash.DirectorySeparatorChar + scene.RegionInfo.RegionID); |
86 | 86 | ||
87 | return svnfilenames; | 87 | return svnfilenames; |
88 | } | 88 | } |
89 | 89 | ||
90 | public void LoadRegion(Scene scene) | 90 | public void LoadRegion(Scene scene) |
91 | { | 91 | { |
92 | scene.LoadPrimsFromXml2(m_svndir + Slash.DirectorySeparatorChar + scene.RegionInfo.RegionID.ToString() + | 92 | scene.LoadPrimsFromXml2(m_svndir + Slash.DirectorySeparatorChar + scene.RegionInfo.RegionID + |
93 | Slash.DirectorySeparatorChar + "objects.xml"); | 93 | Slash.DirectorySeparatorChar + "objects.xml"); |
94 | scene.RequestModuleInterface<ITerrainModule>().LoadFromFile(m_svndir + Slash.DirectorySeparatorChar + scene.RegionInfo.RegionID.ToString() + | 94 | scene.RequestModuleInterface<ITerrainModule>().LoadFromFile(m_svndir + Slash.DirectorySeparatorChar + scene.RegionInfo.RegionID + |
95 | Slash.DirectorySeparatorChar + "heightmap.r32"); | 95 | Slash.DirectorySeparatorChar + "heightmap.r32"); |
96 | m_log.Info("[SVNBACKUP]: Region load successful (" + scene.RegionInfo.RegionName + ")."); | 96 | m_log.Info("[SVNBACKUP]: Region load successful (" + scene.RegionInfo.RegionName + ")."); |
97 | } | 97 | } |
@@ -146,7 +146,7 @@ namespace OpenSim.Region.Modules.SvnSerialiser | |||
146 | } | 146 | } |
147 | } | 147 | } |
148 | 148 | ||
149 | string msg = "Region Backup (" + System.Environment.MachineName + " at " + DateTime.UtcNow.ToString() + " UTC)"; | 149 | string msg = "Region Backup (" + System.Environment.MachineName + " at " + DateTime.UtcNow + " UTC)"; |
150 | 150 | ||
151 | m_log.Debug("[SVNBACKUP]: Saved with message: " + msg); | 151 | m_log.Debug("[SVNBACKUP]: Saved with message: " + msg); |
152 | 152 | ||
@@ -194,10 +194,10 @@ namespace OpenSim.Region.Modules.SvnSerialiser | |||
194 | if (m_enabled == false) | 194 | if (m_enabled == false) |
195 | return; | 195 | return; |
196 | 196 | ||
197 | if (m_svnAutoSave == true) | 197 | if (m_svnAutoSave) |
198 | { | 198 | { |
199 | m_timer.Interval = m_svnperiod.TotalMilliseconds; | 199 | m_timer.Interval = m_svnperiod.TotalMilliseconds; |
200 | m_timer.Elapsed += new ElapsedEventHandler(m_timer_Elapsed); | 200 | m_timer.Elapsed += m_timer_Elapsed; |
201 | m_timer.AutoReset = true; | 201 | m_timer.AutoReset = true; |
202 | m_timer.Start(); | 202 | m_timer.Start(); |
203 | } | 203 | } |