aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Modules/SvnSerialiser/SvnBackupModule.cs
diff options
context:
space:
mode:
authorAdam Frisby2008-04-21 07:09:17 +0000
committerAdam Frisby2008-04-21 07:09:17 +0000
commitfef3b3689492dea63693c964bcdbec9f5137eb5e (patch)
tree7791eef001d85d3e1de863a68f26ff9434d062ca /OpenSim/Region/Modules/SvnSerialiser/SvnBackupModule.cs
parent* Terrain Module code has been reformatted to comply with guidelines. (diff)
downloadopensim-SC-fef3b3689492dea63693c964bcdbec9f5137eb5e.zip
opensim-SC-fef3b3689492dea63693c964bcdbec9f5137eb5e.tar.gz
opensim-SC-fef3b3689492dea63693c964bcdbec9f5137eb5e.tar.bz2
opensim-SC-fef3b3689492dea63693c964bcdbec9f5137eb5e.tar.xz
* Optimised using statements and namespace references across entire project (this took a while to run).
Diffstat (limited to 'OpenSim/Region/Modules/SvnSerialiser/SvnBackupModule.cs')
-rw-r--r--OpenSim/Region/Modules/SvnSerialiser/SvnBackupModule.cs35
1 files changed, 19 insertions, 16 deletions
diff --git a/OpenSim/Region/Modules/SvnSerialiser/SvnBackupModule.cs b/OpenSim/Region/Modules/SvnSerialiser/SvnBackupModule.cs
index aaa7acf..4046a7c 100644
--- a/OpenSim/Region/Modules/SvnSerialiser/SvnBackupModule.cs
+++ b/OpenSim/Region/Modules/SvnSerialiser/SvnBackupModule.cs
@@ -1,20 +1,23 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.IO;
4using System.Reflection;
5using System.Timers;
6using log4net;
3using Nini.Config; 7using Nini.Config;
4using OpenSim.Region.Environment.Interfaces; 8using OpenSim.Region.Environment.Interfaces;
5using OpenSim.Region.Environment.Scenes;
6using OpenSim.Region.Environment.Modules.ExportSerialiser; 9using OpenSim.Region.Environment.Modules.ExportSerialiser;
7 10using OpenSim.Region.Environment.Modules.Terrain;
8using PumaCode.SvnDotNet.SubversionSharp; 11using OpenSim.Region.Environment.Scenes;
9using PumaCode.SvnDotNet.AprSharp; 12using PumaCode.SvnDotNet.AprSharp;
10 13using PumaCode.SvnDotNet.SubversionSharp;
11using Slash=System.IO.Path; 14using Slash=System.IO.Path;
12 15
13namespace OpenSim.Region.Modules.SvnSerialiser 16namespace OpenSim.Region.Modules.SvnSerialiser
14{ 17{
15 public class SvnBackupModule : IRegionModule 18 public class SvnBackupModule : IRegionModule
16 { 19 {
17 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 20 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
18 21
19 private SvnClient m_svnClient; 22 private SvnClient m_svnClient;
20 private bool m_enabled = false; 23 private bool m_enabled = false;
@@ -26,7 +29,7 @@ namespace OpenSim.Region.Modules.SvnSerialiser
26 29
27 private TimeSpan m_svnperiod = new TimeSpan(0, 0, 15, 0, 0); 30 private TimeSpan m_svnperiod = new TimeSpan(0, 0, 15, 0, 0);
28 private bool m_svnAutoSave = false; 31 private bool m_svnAutoSave = false;
29 private System.Timers.Timer m_timer = new System.Timers.Timer(); 32 private Timer m_timer = new Timer();
30 33
31 private IRegionSerialiser m_serialiser; 34 private IRegionSerialiser m_serialiser;
32 private List<Scene> m_scenes = new List<Scene>(); 35 private List<Scene> m_scenes = new List<Scene>();
@@ -87,7 +90,7 @@ namespace OpenSim.Region.Modules.SvnSerialiser
87 { 90 {
88 scene.LoadPrimsFromXml2(m_svndir + Slash.DirectorySeparatorChar + scene.RegionInfo.RegionID.ToString() + 91 scene.LoadPrimsFromXml2(m_svndir + Slash.DirectorySeparatorChar + scene.RegionInfo.RegionID.ToString() +
89 Slash.DirectorySeparatorChar + "objects.xml"); 92 Slash.DirectorySeparatorChar + "objects.xml");
90 scene.RequestModuleInterface<OpenSim.Region.Environment.Modules.Terrain.ITerrainModule>().LoadFromFile(m_svndir + Slash.DirectorySeparatorChar + scene.RegionInfo.RegionID.ToString() + 93 scene.RequestModuleInterface<ITerrainModule>().LoadFromFile(m_svndir + Slash.DirectorySeparatorChar + scene.RegionInfo.RegionID.ToString() +
91 Slash.DirectorySeparatorChar + "heightmap.r32"); 94 Slash.DirectorySeparatorChar + "heightmap.r32");
92 m_log.Info("[SVNBACKUP]: Region load successful (" + scene.RegionInfo.RegionName + ")."); 95 m_log.Info("[SVNBACKUP]: Region load successful (" + scene.RegionInfo.RegionName + ").");
93 } 96 }
@@ -104,16 +107,16 @@ namespace OpenSim.Region.Modules.SvnSerialiser
104 107
105 private void CheckoutSvnPartial(string subdir) 108 private void CheckoutSvnPartial(string subdir)
106 { 109 {
107 if (!System.IO.Directory.Exists(m_svndir + Slash.DirectorySeparatorChar + subdir)) 110 if (!Directory.Exists(m_svndir + Slash.DirectorySeparatorChar + subdir))
108 System.IO.Directory.CreateDirectory(m_svndir + Slash.DirectorySeparatorChar + subdir); 111 Directory.CreateDirectory(m_svndir + Slash.DirectorySeparatorChar + subdir);
109 112
110 m_svnClient.Checkout2(m_svnurl + "/" + subdir, m_svndir, Svn.Revision.Head, Svn.Revision.Head, true, false); 113 m_svnClient.Checkout2(m_svnurl + "/" + subdir, m_svndir, Svn.Revision.Head, Svn.Revision.Head, true, false);
111 } 114 }
112 115
113 private void CheckoutSvnPartial(string subdir, SvnRevision revision) 116 private void CheckoutSvnPartial(string subdir, SvnRevision revision)
114 { 117 {
115 if (!System.IO.Directory.Exists(m_svndir + Slash.DirectorySeparatorChar + subdir)) 118 if (!Directory.Exists(m_svndir + Slash.DirectorySeparatorChar + subdir))
116 System.IO.Directory.CreateDirectory(m_svndir + Slash.DirectorySeparatorChar + subdir); 119 Directory.CreateDirectory(m_svndir + Slash.DirectorySeparatorChar + subdir);
117 120
118 m_svnClient.Checkout2(m_svnurl + "/" + subdir, m_svndir, revision, revision, true, false); 121 m_svnClient.Checkout2(m_svnurl + "/" + subdir, m_svndir, revision, revision, true, false);
119 } 122 }
@@ -138,7 +141,7 @@ namespace OpenSim.Region.Modules.SvnSerialiser
138 { 141 {
139 foreach (SvnClientCommitItem2 item in commitItems) 142 foreach (SvnClientCommitItem2 item in commitItems)
140 { 143 {
141 m_log.Debug("[SVNBACKUP]: ... " + System.IO.Path.GetFileName(item.Path.ToString()) + " (" + item.Kind.ToString() + ") r" + item.Revision.ToString()); 144 m_log.Debug("[SVNBACKUP]: ... " + Path.GetFileName(item.Path.ToString()) + " (" + item.Kind.ToString() + ") r" + item.Revision.ToString());
142 } 145 }
143 } 146 }
144 147
@@ -277,7 +280,7 @@ namespace OpenSim.Region.Modules.SvnSerialiser
277 if (m_svnAutoSave == true) 280 if (m_svnAutoSave == true)
278 { 281 {
279 m_timer.Interval = m_svnperiod.TotalMilliseconds; 282 m_timer.Interval = m_svnperiod.TotalMilliseconds;
280 m_timer.Elapsed += new System.Timers.ElapsedEventHandler(m_timer_Elapsed); 283 m_timer.Elapsed += new ElapsedEventHandler(m_timer_Elapsed);
281 m_timer.AutoReset = true; 284 m_timer.AutoReset = true;
282 m_timer.Start(); 285 m_timer.Start();
283 } 286 }
@@ -300,7 +303,7 @@ namespace OpenSim.Region.Modules.SvnSerialiser
300 } 303 }
301 } 304 }
302 305
303 void m_timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) 306 void m_timer_Elapsed(object sender, ElapsedEventArgs e)
304 { 307 {
305 SaveAllRegions(); 308 SaveAllRegions();
306 } 309 }
@@ -322,8 +325,8 @@ namespace OpenSim.Region.Modules.SvnSerialiser
322 325
323 private void CreateSvnDirectory() 326 private void CreateSvnDirectory()
324 { 327 {
325 if (!System.IO.Directory.Exists(m_svndir)) 328 if (!Directory.Exists(m_svndir))
326 System.IO.Directory.CreateDirectory(m_svndir); 329 Directory.CreateDirectory(m_svndir);
327 } 330 }
328 331
329 public void Close() 332 public void Close()